{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}/Users/Jessica/Dropbox/1_Projects/Civilian PKO projects/Civilian Staff UN PKOs/Data Paper/Versions/1_ISQ Accepted/Replication/uncippo_replicationlog.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}20 Jan 2025, 14:23:34
{txt}
{com}. 
. ssc install schemepack
{txt}checking {hilite:schemepack} consistency and verifying not already installed...
all files already exist and are up to date.

{com}. ssc install kountry
{txt}checking {hilite:kountry} consistency and verifying not already installed...
all files already exist and are up to date.

{com}. set scheme tab3
{txt}
{com}. 
. 
. *DESCRIPTIVES (figure 1 to figure 8)
. preserve
{txt}
{com}. do "descriptives/uncippo_descriptives"
{txt}
{com}. use "uncippo_final.dta", clear
{txt}
{com}. 
. sort country mission *year component section unit
{txt}
{com}. keep if approved==1 | first_report_proposed_only==1
{txt}(4,031 observations deleted)

{com}. 
. replace umbrella1="Support" if support==1
{txt}(358 real changes made)

{com}. replace umbrella1="Trans. Auht" if transit==1
{txt}(53 real changes made)

{com}. replace umbrella_code1=99 if support==1
{txt}(358 real changes made)

{com}. replace umbrella_code1=98 if transit==1
{txt}(53 real changes made)

{com}. 
. *collapsed temporary and non-temporary
. collapse (sum) usg d2 p5 p3 p1 field general securityservice national unitednations total totalsum (first) year country-cown umbrella1 umbrella_code1 (max) support transiti approved proposed organigram first_*, by(mission document component section unit)
{res}{txt}
{com}. 
. gen internationalstaff=total-national
{txt}
{com}. gen substantive=usg + d2 + p5 + p3 + p1 + field + general + securityservice + national + unitednations if support==0
{txt}(261 missing values generated)

{com}. replace substantive=0 if substantive==.
{txt}(261 real changes made)

{com}. gen supportstaff=usg + d2 + p5 + p3 + p1 + field + general + securityservice + national + unitednations if support==1
{txt}(3,942 missing values generated)

{com}. replace supportstaff=0 if supportstaff==.
{txt}(3,942 real changes made)

{com}. gen professional=usg+d2+p5+p3+p1
{txt}
{com}. 
. label var international "International Posts"
{txt}
{com}. label var total "Total Posts"
{txt}
{com}. label var national "National Posts"
{txt}
{com}. label var substantive "Substantive Posts"
{txt}
{com}. label var supportst "Support Posts"
{txt}
{com}. label var professional "Professional Posts"
{txt}
{com}. label var year "Year"
{txt}
{com}. 
. sort country mission *year component section unit
{txt}
{com}. replace total=totals if totals!=total
{txt}(137 real changes made)

{com}. keep if year>1991 & year<2020
{txt}(191 observations deleted)

{com}. 
. *drop UNTAC's unusually large deployment
. drop if unit=="Additional Electoral support" // UNTAC unit w > 60,000
{txt}(1 observation deleted)

{com}. 
. *FIGURE 1 - Overall Yearly Trends
. preserve
{txt}
{com}. collapse (max) usgasg unitednationsvolunteers d2d1 fieldservice generalservice nationalstaff p1 p3p2 p5p4 securityservice international total substantive supportst (first) umbrella_code1 umbrella1 country (first) iso, by(mission year unit)
{res}{txt}
{com}. collapse (sum) usgasg unitednationsvolunteers d2d1 fieldservice generalservice nationalstaff p1 p3p2 p5p4 securityservice international total substantive supportst, by(mission year)
{res}{txt}
{com}. collapse (sum) usgasg unitednationsvolunteers d2d1 fieldservice generalservice nationalstaff p1 p3p2 p5p4 securityservice international total substantive supportst, by(year)
{res}{txt}
{com}. label var international "International Posts"
{txt}
{com}. label var total "Total Posts"
{txt}
{com}. label var national "National Posts"
{txt}
{com}. label var substantive "Substantive Posts"
{txt}
{com}. label var support "Support Posts"
{txt}
{com}. tsset year
{res}
{p 0 15 2}{txt:Time variable: }{res:year}{txt:, }{res:{bind:1992}}{txt: to }{res:{bind:2019}}{p_end}
{txt}{col 9}Delta: {res}1 unit
{txt}
{com}. twoway (tsline international, lcolor(gs12)) (tsline national, lpattern(-) lcolor(gs12)) (tsline total, lcolor(black)) , ytitle(Civilian Posts) legend(size(*1.5))
{res}{txt}
{com}. twoway (tsline substantive, lcolor(gs12)) (tsline supportst, lpattern(-) lcolor(gs12)) (tsline total, lcolor(black)) , ytitle(Civilian Posts) legend(size(*1.5))
{res}{txt}
{com}. restore
{txt}
{com}. 
. 
. 
. *FIGURE 2
. collapse (max) usgasg unitednationsvolunteers d2d1 fieldservice generalservice nationalstaff p1 p3p2 p5p4 securityservice international total substantive supportst (first) umbrella_code1 umbrella1 country iso, by(mission year unit)  
{res}{txt}
{com}. collapse (sum) usgasg unitednationsvolunteers d2d1 fieldservice generalservice nationalstaff p1 p3p2 p5p4 securityservice international total substantive supportst (first) umbrella1 country iso, by(mission year umbrella_code1)
{res}{txt}
{com}.         
. rename total totalstaff
{res}{txt}
{com}. drop umbrella1
{txt}
{com}. drop if umbrella_code1==.
{txt}(13 observations deleted)

{com}. reshape wide usg-support, i(mission country year) j(umbrella_code1)
{txt}(j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 98 99)

Data{col 36}Long{col 43}->{col 48}Wide
{hline 77}
Number of observations     {res}       2,400   {txt}->   {res}250         
{txt}Number of variables        {res}          19   {txt}->   {res}340         
{txt}j variable (24 values)   {res}umbrella_code1   {txt}->   (dropped)
xij variables:
                                 {res}usgasg   {txt}->   {res}usgasg1 usgasg2 ... usgasg99
                unitednationsvolunteers   {txt}->   {res}unitednationsvolunteers1 unitednationsvolunteers2 ... unitednationsvolunteers99
                                   d2d1   {txt}->   {res}d2d11 d2d12 ... d2d199
                           fieldservice   {txt}->   {res}fieldservice1 fieldservice2 ... fieldservice99
                         generalservice   {txt}->   {res}generalservice1 generalservice2 ... generalservice99
                          nationalstaff   {txt}->   {res}nationalstaff1 nationalstaff2 ... nationalstaff99
                                     p1   {txt}->   {res}p11 p12 ... p199
                                   p3p2   {txt}->   {res}p3p21 p3p22 ... p3p299
                                   p5p4   {txt}->   {res}p5p41 p5p42 ... p5p499
                        securityservice   {txt}->   {res}securityservice1 securityservice2 ... securityservice99
                     internationalstaff   {txt}->   {res}internationalstaff1 internationalstaff2 ... internationalstaff99
                             totalstaff   {txt}->   {res}totalstaff1 totalstaff2 ... totalstaff99
                            substantive   {txt}->   {res}substantive1 substantive2 ... substantive99
                           supportstaff   {txt}->   {res}supportstaff1 supportstaff2 ... supportstaff99
{txt}{hline 77}

{com}. gen childprotection_staff=totalstaff1
{txt}(172 missing values generated)

{com}. gen civilaffairs_staff=totalstaff2
{txt}(102 missing values generated)

{com}. gen ddr_staff=totalstaff4
{txt}(182 missing values generated)

{com}. gen electoralaffairs_staff=totalstaff5
{txt}(174 missing values generated)

{com}. gen gender_staff=totalstaff6
{txt}(137 missing values generated)

{com}. gen hiv_staff=totalstaff7
{txt}(150 missing values generated)

{com}. gen humanrights_staff=totalstaff8
{txt}(126 missing values generated)

{com}. gen humanitarian_staff=totalstaff9
{txt}(142 missing values generated)

{com}. gen rol_staff=totalstaff11
{txt}(130 missing values generated)

{com}. gen poc_staff=totalstaff12
{txt}(196 missing values generated)

{com}. gen politicalaffairs_staff=totalstaff13
{txt}(10 missing values generated)

{com}. gen publicinfo_staff=totalstaff14
{txt}(71 missing values generated)

{com}. gen ssr_staff=totalstaff17
{txt}(184 missing values generated)

{com}. gen stabilization_staff=totalstaff18
{txt}(201 missing values generated)

{com}. gen ceasefire_staff=totalstaff19
{txt}(247 missing values generated)

{com}. gen support_staff=totalstaff21
{txt}(102 missing values generated)

{com}. gen demining_staff=totalstaff22
{txt}(240 missing values generated)

{com}. gen childprotection_intstaff=internationalstaff1
{txt}(172 missing values generated)

{com}. gen civilaffairs_intstaff=internationalstaff2
{txt}(102 missing values generated)

{com}. gen ddr_intstaff=internationalstaff4
{txt}(182 missing values generated)

{com}. gen electoralaffairs_intstaff=internationalstaff5
{txt}(174 missing values generated)

{com}. gen gender_intstaff=internationalstaff6
{txt}(137 missing values generated)

{com}. gen hiv_intstaff=internationalstaff7
{txt}(150 missing values generated)

{com}. gen humanrights_intstaff=internationalstaff8
{txt}(126 missing values generated)

{com}. gen humanitarian_intstaff=internationalstaff9
{txt}(142 missing values generated)

{com}. gen rol_intstaff=internationalstaff11
{txt}(130 missing values generated)

{com}. gen poc_intstaff=internationalstaff12
{txt}(196 missing values generated)

{com}. gen politicalaffairs_intstaff=internationalstaff13
{txt}(10 missing values generated)

{com}. gen publicinfo_intstaff=internationalstaff14
{txt}(71 missing values generated)

{com}. gen ssr_intstaff=internationalstaff17
{txt}(184 missing values generated)

{com}. gen stabilization_intstaff=internationalstaff18
{txt}(201 missing values generated)

{com}. gen ceasefire_intstaff=internationalstaff19
{txt}(247 missing values generated)

{com}. gen sanctions_intstaff=internationalstaff20
{txt}(242 missing values generated)

{com}. gen support_intstaff=internationalstaff21
{txt}(102 missing values generated)

{com}. gen demining_intstaff=internationalstaff22
{txt}(240 missing values generated)

{com}. gen childprotection_natstaff=nationalstaff1
{txt}(172 missing values generated)

{com}. gen civilaffairs_natstaff=nationalstaff2
{txt}(102 missing values generated)

{com}. gen ddr_natstaff=nationalstaff4
{txt}(182 missing values generated)

{com}. gen electoralaffairs_natstaff=nationalstaff5
{txt}(174 missing values generated)

{com}. gen gender_natstaff=nationalstaff6
{txt}(137 missing values generated)

{com}. gen hiv_natstaff=nationalstaff7
{txt}(150 missing values generated)

{com}. gen humanrights_natstaff=nationalstaff8
{txt}(126 missing values generated)

{com}. gen humanitarian_natstaff=nationalstaff9
{txt}(142 missing values generated)

{com}. gen rol_natstaff=nationalstaff11
{txt}(130 missing values generated)

{com}. gen poc_natstaff=nationalstaff12
{txt}(196 missing values generated)

{com}. gen politicalaffairs_natstaff=nationalstaff13
{txt}(10 missing values generated)

{com}. gen publicinfo_natstaff=nationalstaff14
{txt}(71 missing values generated)

{com}. gen seniorcivilian_natstaff=nationalstaff15
{txt}(192 missing values generated)

{com}. gen ssr_natstaff=nationalstaff17
{txt}(184 missing values generated)

{com}. gen stabilization_natstaff=nationalstaff18
{txt}(201 missing values generated)

{com}. gen ceasefire_natstaff=nationalstaff19
{txt}(247 missing values generated)

{com}. gen sanctions_natstaff=nationalstaff20
{txt}(242 missing values generated)

{com}. gen support_natstaff=nationalstaff21
{txt}(102 missing values generated)

{com}. gen demining_natstaff=nationalstaff22
{txt}(240 missing values generated)

{com}. 
. order support_*, last
{txt}
{com}. foreach var of varlist childprotection_staff-support_natstaff{c -(}
{txt}  2{com}.         replace `var'=0 if `var'==.
{txt}  3{com}. {c )-}
{txt}(172 real changes made)
(102 real changes made)
(182 real changes made)
(174 real changes made)
(137 real changes made)
(150 real changes made)
(126 real changes made)
(142 real changes made)
(130 real changes made)
(196 real changes made)
(10 real changes made)
(71 real changes made)
(184 real changes made)
(201 real changes made)
(247 real changes made)
(240 real changes made)
(172 real changes made)
(102 real changes made)
(182 real changes made)
(174 real changes made)
(137 real changes made)
(150 real changes made)
(126 real changes made)
(142 real changes made)
(130 real changes made)
(196 real changes made)
(10 real changes made)
(71 real changes made)
(184 real changes made)
(201 real changes made)
(247 real changes made)
(242 real changes made)
(240 real changes made)
(172 real changes made)
(102 real changes made)
(182 real changes made)
(174 real changes made)
(137 real changes made)
(150 real changes made)
(126 real changes made)
(142 real changes made)
(130 real changes made)
(196 real changes made)
(10 real changes made)
(71 real changes made)
(192 real changes made)
(184 real changes made)
(201 real changes made)
(247 real changes made)
(242 real changes made)
(240 real changes made)
(102 real changes made)
(102 real changes made)
(102 real changes made)

{com}. keep country mission year childprotection_staff-support_natstaff
{txt}
{com}. rename year year_budget
{res}{txt}
{com}. gen year = year_budget + 1
{txt}
{com}. replace mission="UNCSPG" if mission=="UNPSG"
{txt}(1 real change made)

{com}. replace mission="UNOSOM I" if mission=="UNOSOM" & year==1992
{txt}(0 real changes made)

{com}. replace mission="UNOSOM II" if mission=="UNOSOM" & year>1992
{txt}(2 real changes made)

{com}. replace mission="UNOMOZ" if mission=="ONUMOZ"
{txt}(0 real changes made)

{com}. 
. *Filling missing budgets with previous year approved
. egen missionid=group(mission)
{txt}
{com}. tsset missionid year
{res}
{col 1}{txt:Panel variable: }{res:missionid}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:year}{txt:, }{res:{bind:1993}}{txt: to }{res:{bind:2020}}{txt:, but with gaps}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. tsfill
{txt}
{com}. foreach var of varlist mission country childprotection_staff-support_natstaff missionid {c -(}
{txt}  2{com}.         cap replace `var'=`var'[_n-1] if `var'==.
{txt}  3{com}.         cap replace `var'=`var'[_n-1] if `var'==""
{txt}  4{com}. 
. {c )-}
{txt}
{com}. 
. replace year_b=year-1 if year_b==.
{txt}(4 real changes made)

{com}. merge m:1 mission year using "descriptives/pema.dta"
{res}{txt}{p 0 7 2}
(variable
{bf:mission} was {bf:str9}, now {bf:str10} to accommodate using data's values)
{p_end}

{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}             165
{txt}{col 9}from master{col 30}{res}              69{txt}  (_merge==1)
{col 9}from using{col 30}{res}              96{txt}  (_merge==2)

{col 5}Matched{col 30}{res}             185{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop if _m!=3 // some cases in UNCIPPO are not in PEMA and viceversa
{txt}(165 observations deleted)

{com}. cap drop missionid 
{txt}
{com}. egen missionid=group(mission)
{txt}
{com}. egen total_staff= rowtotal(childprotection_staff-demining_staff) // excludes support
{txt}
{com}. egen total_mand=rowtotal(childprotection_sum-demining_sum) // excludes support
{txt}
{com}. bysort year: egen y_total_staff= sum(total_staff) 
{txt}
{com}. bysort year: egen y_total_mand= sum(total_mand) 
{txt}
{com}. bysort year: egen y_mean_staff= mean(total_staff) 
{txt}
{com}. bysort year: egen y_mean_mand= mean(total_mand) 
{txt}
{com}. egen total_intstaff= rowtotal(childprotection_intstaff-demining_intstaff) 
{txt}
{com}. egen total_natstaff= rowtotal(childprotection_natstaff-demining_natstaff) 
{txt}
{com}. bysort year: egen y_total_intstaff= sum(total_intstaff) 
{txt}
{com}. bysort year: egen y_total_natstaff= sum(total_natstaff) 
{txt}
{com}. bysort year: egen y_mean_intstaff= mean(total_intstaff) 
{txt}
{com}. bysort year: egen y_mean_natstaff= mean(total_natstaff) 
{txt}
{com}. gen ry_total_intstaff=y_total_intstaff/y_total_staff 
{txt}
{com}. gen ry_total_natstaff=y_total_natstaff/y_total_staff 
{txt}
{com}. gen r_total_intstaff=total_intstaff/total_staff 
{txt}(2 missing values generated)

{com}. gen r_total_natstaff=total_natstaff/total_staff 
{txt}(2 missing values generated)

{com}. 
. drop if year>2017
{txt}(2 observations deleted)

{com}. foreach var in "childprotection" "civilaffairs" "ddr" "electoralaffairs" "gender" "hiv" "humanrights" "humanitarian"  "rol" "poc" "politicalaffairs" "publicinfo" "ssr" "stabilization" "ceasefire" "demining" {c -(}
{txt}  2{com}.         bysort year: egen y_`var'_staff=sum(`var'_staff) 
{txt}  3{com}.         bysort year: egen y_`var'_mand=sum(`var'_sum) 
{txt}  4{com}.         bysort year: egen y_`var'_staffmean=mean(`var'_staff) 
{txt}  5{com}.         bysort year: egen y_`var'_mandmean=mean(`var'_sum) 
{txt}  6{com}.         
.         bysort year: egen y_`var'_staff2=sum(`var'_staff) if mission!="UNTAC"
{txt}  7{com}.         bysort year: egen y_`var'_mand2=sum(`var'_sum) if mission!="UNTAC"
{txt}  8{com}.         bysort year: egen y_`var'_staffmean2=mean(`var'_staff) if mission!="UNTAC"
{txt}  9{com}.         bysort year: egen y_`var'_mandmean2=mean(`var'_sum) if mission!="UNTAC"
{txt} 10{com}. {c )-}
{txt}(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)
(1 missing value generated)

{com}.  
. bysort year: egen y_support_staff=sum(support_staff)
{txt}
{com}. bysort year: egen y_support_staffmean=mean(support_staff)
{txt}
{com}. foreach var in "childprotection" "civilaffairs"  "ddr" "electoralaffairs" "gender" "hiv" "humanrights" "humanitarian"  "rol" "poc" "politicalaffairs" "publicinfo"  "ssr" "stabilization" "ceasefire"  "demining" {c -(}
{txt}  2{com}.          label var y_`var'_staff "Total Staff in `var'"
{txt}  3{com}.          label var y_`var'_mand "Total Mandated Tasks in `var'"
{txt}  4{com}. {c )-}
{txt}
{com}.          label var y_support_staff "Total Staff in Support"      
{txt}
{com}. foreach var in "childprotection" "civilaffairs"  "ddr" "electoralaffairs" "gender" "hiv" "humanrights" "humanitarian"  "rol" "poc" "politicalaffairs" "publicinfo"  "ssr" "stabilization" "ceasefire"  "demining" "support" {c -(}
{txt}  2{com}.          bysort year: egen y_`var'_natstaff=sum(`var'_natstaff) 
{txt}  3{com}.          bysort year: egen y_`var'_intstaff=sum(`var'_intstaff) 
{txt}  4{com}. {c )-}
{txt}
{com}. foreach var in "childprotection" "civilaffairs"  "ddr" "electoralaffairs" "gender" "hiv" "humanrights" "humanitarian"  "rol" "poc" "politicalaffairs" "publicinfo"  "ssr" "stabilization" "ceasefire"  "demining" "support" {c -(}
{txt}  2{com}.         bysort year: gen ry_`var'_natstaff=y_`var'_natstaff / (y_`var'_staff) if y_`var'_natstaff!=0
{txt}  3{com}.         bysort year: gen ry_`var'_intstaff=y_`var'_intstaff / (y_`var'_staff) if y_`var'_intstaff!=0
{txt}  4{com}.         replace ry_`var'_intstaff=0 if ry_`var'_intstaff==.
{txt}  5{com}.         replace  ry_`var'_natstaff=0 if  ry_`var'_natstaff==.
{txt}  6{com}.         {c )-}
{txt}(54 missing values generated)
(54 missing values generated)
(54 real changes made)
(54 real changes made)
(1 missing value generated)
(1 missing value generated)
(1 real change made)
(1 real change made)
(46 missing values generated)
(46 missing values generated)
(46 real changes made)
(46 real changes made)
(38 missing values generated)
(17 missing values generated)
(17 real changes made)
(38 real changes made)
(60 missing values generated)
(60 missing values generated)
(60 real changes made)
(60 real changes made)
(60 missing values generated)
(60 missing values generated)
(60 real changes made)
(60 real changes made)
(8 missing values generated)
(1 missing value generated)
(1 real change made)
(8 real changes made)
(19 missing values generated)
(19 missing values generated)
(19 real changes made)
(19 real changes made)
(54 missing values generated)
(54 missing values generated)
(54 real changes made)
(54 real changes made)
(54 missing values generated)
(54 missing values generated)
(54 real changes made)
(54 real changes made)
(0 real changes made)
(0 real changes made)
(11 missing values generated)
(11 missing values generated)
(11 real changes made)
(11 real changes made)
(67 missing values generated)
(53 missing values generated)
(53 real changes made)
(67 real changes made)
(54 missing values generated)
(54 missing values generated)
(54 real changes made)
(54 real changes made)
(183 missing values generated)
(158 missing values generated)
(158 real changes made)
(183 real changes made)
(177 missing values generated)
(114 missing values generated)
(114 real changes made)
(177 real changes made)
(11 missing values generated)
(11 missing values generated)
(11 real changes made)
(11 real changes made)

{com}. cap egen missionid=group(mission)
{txt}
{com}. twoway (tsline y_mean_staff, lcolor(gs12)) (tsline y_mean_mand, yaxis(2) lcolor(black)), legend(pos(6) col(2) order(1 "Budgeted Posts" 2 "Mandated Tasks") size(*1.5)) ytitle("Avg. Civilian Posts") ytitle("Avg. Tasks per Mission", axis(2)) xtitle("Year")
{res}{txt}
{com}. 
. *FIGURE 3
. twoway (tsline y_gender_mandmean, lcolor(black) lwidth(medium)) (tsline y_gender_staffmean, yaxis(2) lcolor(gs12) lwidth(medium)), legend(pos(6) col(2) order(1   "Mandated Tasks" 2 "Budgeted Posts") size(*1.5)) ytitle("Avg. Civilian Posts", axis(2)) ytitle("Avg. Tasks per Mission ") xtitle("Year") title("Gender")
{res}{txt}
{com}. twoway (tsline y_humanitarian_mandmean, lcolor(black) lwidth(medium)) (tsline y_humanitarian_staffmean, yaxis(2) lcolor(gs12) lwidth(medium)), legend(pos(6) col(2) order(1   "Mandated Tasks" 2 "Budgeted Posts") size(*1.5)) ytitle("Avg. Civilian Posts", axis(2)) ytitle("Avg. Tasks per Mission ") xtitle("Year")  title("Humanitarian Coordination")
{res}{txt}
{com}. twoway (tsline y_electoralaffairs_mandmean2, lcolor(black) lwidth(medium)) (tsline y_electoralaffairs_staffmean2, yaxis(2) lcolor(gs12) lwidth(medium)), legend(pos(6) col(2) order(1   "Mandated Tasks" 2 "Budgeted Posts") size(*1.5)) ytitle("Avg. Civilian Posts", axis(2)) ytitle("Avg. Tasks per Mission ") xtitle("Year")  title("Elections")
{res}{txt}
{com}. twoway (tsline y_humanrights_mandmean, lcolor(black) lwidth(medium)) (tsline y_humanrights_staffmean, yaxis(2) lcolor(gs12) lwidth(medium)), legend(pos(6) col(2) order(1   "Mandated Tasks" 2 "Budgeted Posts") size(*1.5)) ytitle("Avg. Civilian Posts", axis(2)) ytitle("Avg. Tasks per Mission ") xtitle("Year")  title("Human Rights")
{res}{txt}
{com}. 
. 
. *FIGURE 6
. use "uncippo_final.dta", clear
{txt}
{com}. 
. sort country mission *year component section unit
{txt}
{com}. keep if approved==1 | first_report_proposed_only==1
{txt}(4,031 observations deleted)

{com}. replace umbrella1="Support" if support==1
{txt}(358 real changes made)

{com}. replace umbrella1="Trans. Auht" if transit==1
{txt}(53 real changes made)

{com}. replace umbrella_code1=99 if support==1
{txt}(358 real changes made)

{com}. replace umbrella_code1=98 if transit==1
{txt}(53 real changes made)

{com}. collapse (sum) usg d2 p5 p3 p1 field general securityservice national unitednations total totalsum (first) year country-cown umbrella1 umbrella_code1 (max) support transiti approved proposed organigram first_*, by(mission document component section unit)
{res}{txt}
{com}. gen internationalstaff=total-national
{txt}
{com}. gen substantive=usg + d2 + p5 + p3 + p1 + field + general + securityservice + national + unitednations if support==0
{txt}(261 missing values generated)

{com}. replace substantive=0 if substantive==.
{txt}(261 real changes made)

{com}. gen supportstaff=usg + d2 + p5 + p3 + p1 + field + general + securityservice + national + unitednations if support==1
{txt}(3,942 missing values generated)

{com}. replace supportstaff=0 if supportstaff==.
{txt}(3,942 real changes made)

{com}. gen professional=usg+d2+p5+p3+p1
{txt}
{com}. label var international "International Posts"
{txt}
{com}. label var total "Total Posts"
{txt}
{com}. label var national "National Posts"
{txt}
{com}. label var substantive "Substantive Posts"
{txt}
{com}. label var supportst "Support Posts"
{txt}
{com}. label var professional "Professional Posts"
{txt}
{com}. label var year "Year"
{txt}
{com}. sort country mission *year component section unit
{txt}
{com}. replace total=totals if totals!=total
{txt}(137 real changes made)

{com}. drop if unit=="Additional Electoral support" // UNTAC unit w > 60,000
{txt}(1 observation deleted)

{com}. 
. preserve
{txt}
{com}. replace umbrella_code1=11 if umbrella_code1==3
{txt}(70 real changes made)

{com}. collapse (mean) usg-total international-professional, by(year) 
{res}{txt}
{com}. gen total_professional=usg+ d2+ p5 +p3 +p1 
{txt}
{com}. gen total_international=total-nat
{txt}
{com}. gen sh_usg=usg/total
{txt}
{com}. gen sh_d=d2/total
{txt}
{com}. gen sh_p=(p1+p3+p5)/total
{txt}
{com}. gen sh_usg_p=usg/total_p
{txt}
{com}. gen sh_d_p=d2/total_p
{txt}
{com}. gen sh_p_p=(p1+p3+p5)/total_p
{txt}
{com}. gen sh_prof=total_prof/total
{txt}
{com}. gen sh_international=total_international/total
{txt}
{com}. gen sh_fs=field/total
{txt}
{com}. gen sh_gs=generalservice/total
{txt}
{com}. gen sh_npo=national/total
{txt}
{com}. gen sh_unv=unitednationsvolunteers/total
{txt}
{com}. 
. graph bar (asis) sh_fs sh_gs sh_npo sh_unv sh_prof, over(year, sort(year) lab(angle(45))) ytitle("% of Total Posts") legend(position(bottom) label(1 "Field Service") label(2 "General Service") label(3 "National") label(4 "UNV") label(5 "Professional"))  bar(1, color(black)) bar(2, color(gs5)) bar(3, color(gs8)) bar(4, color(gs12)) bar(5, color(gs14))  percentages stack 
{res}{txt}
{com}. graph bar (asis) sh_usg_p sh_d_p sh_p_p, over(year, sort(year) lab(angle(45))) ytitle("% of Professional Posts") legend(position(bottom) label(1 "ASG/USG") label(2 "D") label(3 "P"))  bar(1, color(gs4)) bar(2, color(gs12)) bar(3, color(gs14)) percentages stack
{res}{txt}
{com}. restore
{txt}
{com}. 
. *FIGURE 7
. preserve
{txt}
{com}. *keep if year>2004 
. drop if support==1  | transit==1
{txt}(314 observations deleted)

{com}. collapse (mean) usg-total international-supportst (first) umbrella1 country, by(umbrella_code1) 
{res}{txt}
{com}. gen umbrella1_short=umbrella1
{txt}
{com}. drop if umbrella1=="NA"
{txt}(1 observation deleted)

{com}. replace umbrella1_short="PoC" if umbrella_code1==12
{txt}(1 real change made)

{com}. replace umbrella1_short="Gender" if umbrella_code1==6
{txt}(1 real change made)

{com}. replace umbrella1_short="Humanitarian" if umbrella_code1==9
{txt}(1 real change made)

{com}. replace umbrella1_short="Justice" if umbrella_code1==11
{txt}(1 real change made)

{com}. replace umbrella1_short="Public Info" if umbrella_code1==14
{txt}(1 real change made)

{com}. replace umbrella1_short="Stablization" if umbrella_code1==18
{txt}(1 real change made)

{com}. replace umbrella1_short="Info Collect & Analysis" if umbrella_code1==10
{txt}(1 real change made)

{com}. replace umbrella1_short="Int. Management" if umbrella_code1==21
{txt}(1 real change made)

{com}. replace umbrella1_short="Sen. Civ. Leader" if umbrella_code1==15
{txt}(1 real change made)

{com}. replace umbrella1_short="Sen. Unif. Leader" if umbrella_code1==16
{txt}(1 real change made)

{com}. egen umbrescale=group(umbrella1_sh)
{txt}
{com}. egen umbid=group(umbrescale)
{txt}
{com}. labmask umbid, values(umbrella1_sh)
{txt}
{com}. tab umbid

      {txt}group(umbrescale) {c |}      Freq.     Percent        Cum.
{hline 24}{c +}{hline 35}
              Ceasefire {c |}{res}          1        4.55        4.55
{txt}       Child Protection {c |}{res}          1        4.55        9.09
{txt}          Civil Affairs {c |}{res}          1        4.55       13.64
{txt}            Corrections {c |}{res}          1        4.55       18.18
{txt}                DDR(RR) {c |}{res}          1        4.55       22.73
{txt}               Demining {c |}{res}          1        4.55       27.27
{txt}      Electoral Affairs {c |}{res}          1        4.55       31.82
{txt}                 Gender {c |}{res}          1        4.55       36.36
{txt}               HIV/AIDS {c |}{res}          1        4.55       40.91
{txt}           Human Rights {c |}{res}          1        4.55       45.45
{txt}           Humanitarian {c |}{res}          1        4.55       50.00
{txt}Info Collect & Analysis {c |}{res}          1        4.55       54.55
{txt}        Int. Management {c |}{res}          1        4.55       59.09
{txt}                Justice {c |}{res}          1        4.55       63.64
{txt}                    PoC {c |}{res}          1        4.55       68.18
{txt}      Political Affairs {c |}{res}          1        4.55       72.73
{txt}            Public Info {c |}{res}          1        4.55       77.27
{txt}                    SSR {c |}{res}          1        4.55       81.82
{txt}              Sanctions {c |}{res}          1        4.55       86.36
{txt}       Sen. Civ. Leader {c |}{res}          1        4.55       90.91
{txt}      Sen. Unif. Leader {c |}{res}          1        4.55       95.45
{txt}           Stablization {c |}{res}          1        4.55      100.00
{txt}{hline 24}{c +}{hline 35}
                  Total {c |}{res}         22      100.00
{txt}
{com}. gen total_international=total-national 
{txt}
{com}. gen total_professional=usg + d2 + p1 + p3 + p5 
{txt}
{com}. gen sh_usg=usg/total
{txt}
{com}. gen sh_d=d2/total
{txt}
{com}. gen sh_p=(p1+p3+p5)/total
{txt}
{com}. gen sh_usg_p=usg/total_p
{txt}
{com}. gen sh_d_p=d2/total_p
{txt}
{com}. gen sh_p_p=(p1+p3+p5)/total_p
{txt}
{com}. gen sh_international=total_international/total
{txt}
{com}. gen sh_fs=field/total
{txt}
{com}. gen sh_gs=generalservice/total
{txt}
{com}. gen sh_npo=national/total
{txt}
{com}. gen sh_unv=unitednationsvolunteers/total
{txt}
{com}. graph hbar (asis) sh_fs sh_gs sh_npo sh_unv sh_p, over(umbid, sort(sh_p)) ///
> legen(position(bottom) label(1 "Field Service") label(2 "General Service") label(3 "National") label(4 "UNV") label(5 "Professional"))  bar(1, color(black)) bar(2, color(gs5)) bar(3, color(gs8)) bar(4, color(gs12)) bar(5, color(gs14))  /// 
>  ytitle ("% of Total Posts")percentages stack
{res}{txt}
{com}. restore
{txt}
{com}. 
. 
. *FIGURE 8
. use "uncippo_final.dta", clear
{txt}
{com}. 
. sort country mission *year component section unit
{txt}
{com}. keep if approved==1 | first_report_proposed_only==1
{txt}(4,031 observations deleted)

{com}. 
. replace international=total-nationalst-unitednationsvolunteers
{txt}(4,137 real changes made)

{com}. gen national_temp=nationalst if temp==1
{txt}(4,192 missing values generated)

{com}. gen international_temp=international if temp==1
{txt}(4,192 missing values generated)

{com}. gen unv=unitednationsvolunteers if temp==0
{txt}(311 missing values generated)

{com}. gen unv_temp=unitednationsvolunteers if temp==1
{txt}(4,192 missing values generated)

{com}. replace nationalstaff=. if national_temp!=.
{txt}(311 real changes made, 311 to missing)

{com}. replace international=. if international_temp!=.
{txt}(311 real changes made, 311 to missing)

{com}. keep country iso3n cown mission budget_year nationalstaff unv* international total year approved temporary national_temp international_temp
{txt}
{com}. foreach var of varlist nationalstaff unv unv_temp international total national_temp international_temp{c -(}
{txt}  2{com}.         replace `var'=0 if `var'==.
{txt}  3{com}. {c )-}
{txt}(311 real changes made)
(311 real changes made)
(4,192 real changes made)
(311 real changes made)
(0 real changes made)
(4,192 real changes made)
(4,192 real changes made)

{com}. collapse (sum) nationalstaff unv* international total national_temp international_temp (first) iso3n, by(mission year)
{res}{txt}
{com}. rename nationalst national
{res}{txt}
{com}. replace mission = subinstr(mission, " ", "", .)
{txt}(0 real changes made)

{com}. 
. merge 1:1 mission year using "descriptives/vacancy_rate.dta" 
{res}{txt}{p 0 7 2}
(variable
{bf:mission} was {bf:str9}, now {bf:str41} to accommodate using data's values)
{p_end}

{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}             178
{txt}{col 9}from master{col 30}{res}              89{txt}  (_merge==1)
{col 9}from using{col 30}{res}              89{txt}  (_merge==2)

{col 5}Matched{col 30}{res}             184{txt}  (_merge==3)
{col 5}{hline 41}

{com}. br mission year if _m==1 & year>2003 // only last year of MINURCAT and UNMIT are not matched
{txt}
{com}. drop if _m==2
{txt}(89 observations deleted)

{com}. drop _m
{txt}
{com}. 
. keep if mission=="MONUC" | mission=="MONUSCO"
{txt}(253 observations deleted)

{com}. keep if year>2004
{txt}(4 observations deleted)

{com}. gen est_int=international - ((international/100)*(vr_international))
{txt}
{com}. gen est_nat=national - ((national/100)*(vr_national))
{txt}
{com}. gen est_unv=unv - ((unv/100)*(vr_unv))
{txt}
{com}. 
. twoway bar international year, barw(0.4) bc(gray) ///
> || bar est_int year, barw(0.4) bc(black) ytitle(International Civilian Posts) xtitle(Year) xla(, tlc(none)) yscale(range(0 1200)) legend(label(1 "Budgeted Posts") label(2 "Filled Posts (estimated)")) title("MONUC/MONUSCO")
{res}{txt}
{com}. 
. twoway bar national year, barw(0.4) bc(gray) ///
> || bar est_nat year, barw(0.4) bc(black) ytitle(National Civilian Posts) xtitle(Year) xla(, tlc(none)) yscale(range(0 1200)) legend(label(1 "Budgeted Posts") label(2 "Filled Posts (estimated)")) title("MONUC/MONUSCO")
{res}{txt}
{com}. 
. twoway bar unv year, barw(0.4) bc(gray) ///
> || bar est_unv year, barw(0.4) bc(black) ytitle(UNV Posts) xtitle(Year) xla(, tlc(none)) yscale(range(0 600)) legend(label(1 "Budgeted Posts") label(2 "Filled Posts (estimated)")) title("MONUC/MONUSCO")
{res}{txt}
{com}. 
.         
. *FIGURE 4
. use "descriptives/mandate_budget_match.dta", replace
{txt}
{com}. preserve
{txt}
{com}. tab mission

    {txt}mission {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     MINUCI {c |}{res}         22        0.54        0.54
{txt}    MINURCA {c |}{res}         44        1.08        1.62
{txt}   MINURCAT {c |}{res}         88        2.16        3.78
{txt}    MINURSO {c |}{res}        418       10.27       14.05
{txt}    MINUSCA {c |}{res}         88        2.16       16.22
{txt}    MINUSMA {c |}{res}         66        1.62       17.84
{txt}   MINUSTAH {c |}{res}        308        7.57       25.41
{txt}    MIPONUH {c |}{res}         44        1.08       26.49
{txt}      MONUA {c |}{res}         44        1.08       27.57
{txt}      MONUC {c |}{res}        220        5.41       32.97
{txt}    MONUSCO {c |}{res}        154        3.78       36.76
{txt}       ONUB {c |}{res}         66        1.62       38.38
{txt}     UNAMID {c |}{res}        242        5.95       44.32
{txt}     UNAMIR {c |}{res}         22        0.54       44.86
{txt}    UNAMSIL {c |}{res}         88        2.16       47.03
{txt}     UNAVEM {c |}{res}         66        1.62       48.65
{txt}     UNCSPG {c |}{res}         22        0.54       49.19
{txt}     UNMIBH {c |}{res}        154        3.78       52.97
{txt}      UNMIH {c |}{res}         44        1.08       54.05
{txt}      UNMIL {c |}{res}        330        8.11       62.16
{txt}      UNMIS {c |}{res}        132        3.24       65.41
{txt}     UNMISS {c |}{res}        132        3.24       68.65
{txt}      UNMIT {c |}{res}        154        3.78       72.43
{txt}      UNMOT {c |}{res}         88        2.16       74.59
{txt}      UNOCI {c |}{res}        264        6.49       81.08
{txt}     UNOMIG {c |}{res}        308        7.57       88.65
{txt}     UNOMIL {c |}{res}        110        2.70       91.35
{txt}    UNOMSIL {c |}{res}         44        1.08       92.43
{txt}   UNOSOM I {c |}{res}         22        0.54       92.97
{txt}  UNOSOM II {c |}{res}         22        0.54       93.51
{txt}   UNPREDEP {c |}{res}         44        1.08       94.59
{txt}   UNPROFOR {c |}{res}         66        1.62       96.22
{txt}     UNSMIH {c |}{res}         22        0.54       96.76
{txt}      UNTAC {c |}{res}         22        0.54       97.30
{txt}     UNTAES {c |}{res}         44        1.08       98.38
{txt}     UNTAET {c |}{res}         44        1.08       99.46
{txt}     UNTMIH {c |}{res}         22        0.54      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      4,070      100.00
{txt}
{com}. keep if mission=="MONUC" | mission=="UNMIL" | mission=="UNAMID" | mission=="UNMOT"
{txt}(3,190 observations deleted)

{com}. tab umbrella1

     {txt}Umbrella personnel category (long) {c |}      Freq.     Percent        Cum.
{hline 40}{c +}{hline 35}
                              Ceasefire {c |}{res}         40        4.55        4.55
{txt}                       Child Protection {c |}{res}         40        4.55        9.09
{txt}                          Civil Affairs {c |}{res}         40        4.55       13.64
{txt}                            Corrections {c |}{res}         40        4.55       18.18
{txt}                                DDR(RR) {c |}{res}         40        4.55       22.73
{txt}                               Demining {c |}{res}         40        4.55       27.27
{txt}                      Electoral Affairs {c |}{res}         40        4.55       31.82
{txt}                          Gender & SGBV {c |}{res}         40        4.55       36.36
{txt}                               HIV/AIDS {c |}{res}         40        4.55       40.91
{txt}                           Human Rights {c |}{res}         40        4.55       45.45
{txt}              Humanitarian Coordination {c |}{res}         40        4.55       50.00
{txt}             Info Collection & Analysis {c |}{res}         40        4.55       54.55
{txt}                    Internal Management {c |}{res}         40        4.55       59.09
{txt}                  Justice & Rule of Law {c |}{res}         40        4.55       63.64
{txt}                      Political Affairs {c |}{res}         40        4.55       68.18
{txt}                Protection of Civilians {c |}{res}         40        4.55       72.73
{txt}Public Information & Strategic Commun.. {c |}{res}         40        4.55       77.27
{txt}                                    SSR {c |}{res}         40        4.55       81.82
{txt}                              Sanctions {c |}{res}         40        4.55       86.36
{txt}             Senior Civilian Leadership {c |}{res}         40        4.55       90.91
{txt}            Senior Uniformed Leadership {c |}{res}         40        4.55       95.45
{txt}    Stabilization (incl Early Recovery) {c |}{res}         40        4.55      100.00
{txt}{hline 40}{c +}{hline 35}
                                  Total {c |}{res}        880      100.00
{txt}
{com}. keep if umbrella1=="Electoral Affairs"
{txt}(840 observations deleted)

{com}. egen missionid=group(mission)
{txt}
{com}. bysort missionid: egen elect_ever=max(electoralaffairs_sum)
{txt}
{com}. codebook elect_ever

{txt}{hline}
{res}elect_ever{right:(unlabeled)}
{txt}{hline}

{col 19}Type: Numeric ({res}float{txt})

{col 18}Range: [{res}1{txt},{res}3{txt}]{col 55}Units: {res}1
{col 10}{txt}Unique values: {res}3{col 51}{txt}Missing .: {res}0{txt}/{res}40

{txt}{col 13}Tabulation: Freq.  Value
{col 20}{res}        15{col 32}1
{col 20}        10{col 32}2
{col 20}        15{col 32}3
{txt}
{com}. keep if elect_ever>0
{txt}(0 observations deleted)

{com}. tsset missionid year
{res}
{col 1}{txt:Panel variable: }{res:missionid}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:year}{txt:, }{res:{bind:1996}}{txt: to }{res:{bind:2017}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. gen pipe = "|"
{txt}
{com}. gen Election_Mandate=-50
{txt}
{com}. twoway (scatter total year if elect_ever>0 & total!=0 & mission!="UNTAC", mcolor(gray) msize(medium) mlwidth(medium) msymbol(oh) lcolor(gray) lwidth(medium) by(mission) yscale(range(0 400))legend(label(1 "Election Posts Budgeted"))) (scatter total year if elect_ever>0 & total==0 & mission!="UNTAC", mcolor(gs13) msize(medium) mlwidth(medium) msymbol(X) lcolor(gs13) lwidth(medium) by(mission) yscale(range(0 400))  legend(label(2 "Election Posts not Budgeted")))  (scatter Election_Mandate year if total>0 & elect_ever>0 & mission!="UNTAC",  ms(none) mlabel(pipe) mlabpos(0) by(mission) yscale(range(0 400))), yscale(range(0 400))
{res}{txt}
{com}. restore
{txt}
{com}. 
. 
. *FIGURE 5
. preserve        
{txt}
{com}. keep if mission=="MONUC" | mission=="MONUSCO"
{txt}(3,696 observations deleted)

{com}. tab year

       {txt}Year {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
       2001 {c |}{res}         22        5.88        5.88
{txt}       2002 {c |}{res}         22        5.88       11.76
{txt}       2003 {c |}{res}         22        5.88       17.65
{txt}       2004 {c |}{res}         22        5.88       23.53
{txt}       2005 {c |}{res}         22        5.88       29.41
{txt}       2006 {c |}{res}         22        5.88       35.29
{txt}       2007 {c |}{res}         22        5.88       41.18
{txt}       2008 {c |}{res}         22        5.88       47.06
{txt}       2009 {c |}{res}         22        5.88       52.94
{txt}       2010 {c |}{res}         22        5.88       58.82
{txt}       2011 {c |}{res}         22        5.88       64.71
{txt}       2012 {c |}{res}         22        5.88       70.59
{txt}       2013 {c |}{res}         22        5.88       76.47
{txt}       2014 {c |}{res}         22        5.88       82.35
{txt}       2015 {c |}{res}         22        5.88       88.24
{txt}       2016 {c |}{res}         22        5.88       94.12
{txt}       2017 {c |}{res}         22        5.88      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}        374      100.00
{txt}
{com}. tab mission

    {txt}mission {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
      MONUC {c |}{res}        220       58.82       58.82
{txt}    MONUSCO {c |}{res}        154       41.18      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}        374      100.00
{txt}
{com}. drop if umbrella1=="Senior Civilian Leadership" | umbrella1=="Senior Uniformed Leadership" | umbrella1=="Support" | umbrella1=="Info Collection & Analysis" | umbrella1=="Internal Management"
{txt}(68 observations deleted)

{com}. egen umbrescale=group(umbrella1_sh)
{txt}
{com}. egen umbid=group(umbrescale)
{txt}
{com}. labmask umbid, values(umbrella1_sh)
{txt}
{com}. tab umbid

{txt}group(umbrescale) {c |}      Freq.     Percent        Cum.
{hline 18}{c +}{hline 35}
        Ceasefire {c |}{res}         17        5.56        5.56
{txt} Child Protection {c |}{res}         17        5.56       11.11
{txt}    Civil Affairs {c |}{res}         17        5.56       16.67
{txt}      Corrections {c |}{res}         17        5.56       22.22
{txt}          DDR(RR) {c |}{res}         17        5.56       27.78
{txt}         Demining {c |}{res}         17        5.56       33.33
{txt}Electoral Affairs {c |}{res}         17        5.56       38.89
{txt}    Gender & SGBV {c |}{res}         17        5.56       44.44
{txt}         HIV/AIDS {c |}{res}         17        5.56       50.00
{txt}     Human Rights {c |}{res}         17        5.56       55.56
{txt}     Humanitarian {c |}{res}         17        5.56       61.11
{txt}          Justice {c |}{res}         17        5.56       66.67
{txt}              PoC {c |}{res}         17        5.56       72.22
{txt}Political Affairs {c |}{res}         17        5.56       77.78
{txt}      Public Info {c |}{res}         17        5.56       83.33
{txt}              SSR {c |}{res}         17        5.56       88.89
{txt}        Sanctions {c |}{res}         17        5.56       94.44
{txt}     Stablization {c |}{res}         17        5.56      100.00
{txt}{hline 18}{c +}{hline 35}
            Total {c |}{res}        306      100.00
{txt}
{com}. sort umbid year
{txt}
{com}. cap by umbid: gen time=_n
{txt}
{com}. cap label var time "Year"
{txt}
{com}. drop if match==. & umbid==19
{txt}(0 observations deleted)

{com}. twoway (scatter umbid time if match==1, msize(large) mlwidth(medium) ms(Oh) mcol(gs12) ylabel(1(1)18, valuelabel labsize(vsmall) angle(horizontal))) ///
> (scatter umbid time if match==2, msize(large) mlwidth(medium)  ms(X) mcol(gs12) ylabel(1(1)18,                  valuelabel labsize(vsmall) angle(horizontal))) /// 
> (scatter umbid time if match==3, msize(large) mlwidth(medium) ms(square) mcol(gray) ylabel(1(1)18, valuelabel labsize(vsmall) angle(horizontal))), aspectratio(.7) legend(position(bottom) label(1 "Mandated only") label(2 "Budgeted only") label(3 "Mandated & Budgeted") col(3)) title("MONUC/MONUSCO") ytitle("Area of Expertise") xlabel(1 "2001" 4 "2004" 8 "2008" 12 "2012" 16 "2016")
{res}{txt}
{com}. restore
{txt}
{com}. 
{txt}end of do-file

{com}. restore
{txt}
{com}. 
. *RE-EVALUATION (figure 9 to 11)
. preserve
{txt}
{com}. do "BDSreplication/reexamine_bds"
{txt}
{com}. clear all 
{res}{txt}
{com}. 
. use "uncippo_final.dta", clear
{txt}
{com}. 
. sort country mission *year component section unit
{txt}
{com}. keep if approved==1 | first_report_proposed_only==1
{txt}(4,031 observations deleted)

{com}. 
. replace umbrella1="Support" if support==1
{txt}(358 real changes made)

{com}. replace umbrella1="Trans. Auht" if transit==1
{txt}(53 real changes made)

{com}. replace umbrella_code1=99 if support==1
{txt}(358 real changes made)

{com}. replace umbrella_code1=98 if transit==1
{txt}(53 real changes made)

{com}. 
. *collapsed temporary and non-temporary
. collapse (sum) usg d2 p5 p3 p1 field general securityservice national unitednations total totalsum (first) year country-cown umbrella1 umbrella_code1 (max) support transiti approved proposed organigram first_*, by(mission document component section unit)
{res}{txt}
{com}. 
. gen internationalstaff=total-national
{txt}
{com}. gen substantive=usg + d2 + p5 + p3 + p1 + field + general + securityservice + national + unitednations if support==0
{txt}(261 missing values generated)

{com}. replace substantive=0 if substantive==.
{txt}(261 real changes made)

{com}. gen supportstaff=usg + d2 + p5 + p3 + p1 + field + general + securityservice + national + unitednations if support==1
{txt}(3,942 missing values generated)

{com}. replace supportstaff=0 if supportstaff==.
{txt}(3,942 real changes made)

{com}. gen professional=usg+d2+p5+p3+p1
{txt}
{com}. 
. label var international "International Posts"
{txt}
{com}. label var total "Total Posts"
{txt}
{com}. label var national "National Posts"
{txt}
{com}. label var substantive "Substantive Posts"
{txt}
{com}. label var supportst "Support Posts"
{txt}
{com}. label var professional "Professional Posts"
{txt}
{com}. label var year "Year"
{txt}
{com}. 
. sort country mission *year component section unit
{txt}
{com}. replace total=totals if totals!=total
{txt}(137 real changes made)

{com}. 
. keep if umbrella1!="Support" & umbrella1!="NA"
{txt}(280 observations deleted)

{com}. tab umbrella1

                      {txt}(first) umbrella1 {c |}      Freq.     Percent        Cum.
{hline 40}{c +}{hline 35}
                              Ceasefire {c |}{res}          3        0.08        0.08
{txt}                       Child Protection {c |}{res}         93        2.37        2.45
{txt}                          Civil Affairs {c |}{res}        242        6.17        8.62
{txt}                            Corrections {c |}{res}         70        1.78       10.40
{txt}                                DDR(RR) {c |}{res}         77        1.96       12.36
{txt}                               Demining {c |}{res}         10        0.25       12.62
{txt}                      Electoral Affairs {c |}{res}         89        2.27       14.89
{txt}                          Gender & SGBV {c |}{res}        148        3.77       18.66
{txt}                               HIV/AIDS {c |}{res}        115        2.93       21.59
{txt}                           Human Rights {c |}{res}        159        4.05       25.64
{txt}              Humanitarian Coordination {c |}{res}        163        4.15       29.80
{txt}    Information Collection and Analysis {c |}{res}        179        4.56       34.36
{txt}                    Internal Management {c |}{res}        341        8.69       43.05
{txt}                Justice and Rule of Law {c |}{res}        247        6.30       49.35
{txt}                      Political Affairs {c |}{res}        879       22.41       71.76
{txt}                Protection of Civilians {c |}{res}         86        2.19       73.95
{txt}Public Information and Strategic Comm.. {c |}{res}        252        6.42       80.37
{txt}                                    SSR {c |}{res}         72        1.84       82.21
{txt}                              Sanctions {c |}{res}          8        0.20       82.41
{txt}             Senior Civilian Leadership {c |}{res}         86        2.19       84.60
{txt}            Senior Uniformed Leadership {c |}{res}        495       12.62       97.22
{txt}    Stabilization (incl Early Recovery) {c |}{res}         56        1.43       98.65
{txt}                            Trans. Auht {c |}{res}         53        1.35      100.00
{txt}{hline 40}{c +}{hline 35}
                                  Total {c |}{res}      3,923      100.00
{txt}
{com}. 
. *Match Sample: Africa from 1991 to 2016
. kountry iso3n, from(iso3n) geo(un)

{txt}{hline 51}
The command has finished.
The new variables are named {com}NAMES_STD {txt}and {com}GEO{txt}.
{hline 51}

{com}. tab GEO

        {txt}GEO {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     Africa {c |}{res}      2,608       74.43       74.43
{txt}   Americas {c |}{res}        380       10.84       85.27
{txt}       Asia {c |}{res}        381       10.87       96.15
{txt}     Europe {c |}{res}        135        3.85      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      3,504      100.00
{txt}
{com}. keep if GEO=="Africa"
{txt}(1,315 observations deleted)

{com}. keep if year>=1991 & year<=2016
{txt}(518 observations deleted)

{com}. 
. *Code Democracy-relevant posts
. *Dummy
. gen dem_dummy=0
{txt}
{com}. replace dem_dummy=1  if umbrella1=="Electoral Affairs" | umbrella1=="Political Affairs"
{txt}(507 real changes made)

{com}. label var dem_dummy "Any Democracy Post"
{txt}
{com}. 
. *Size
. tab umbrella1 

                      {txt}(first) umbrella1 {c |}      Freq.     Percent        Cum.
{hline 40}{c +}{hline 35}
                              Ceasefire {c |}{res}          3        0.14        0.14
{txt}                       Child Protection {c |}{res}         55        2.63        2.78
{txt}                          Civil Affairs {c |}{res}        103        4.93        7.70
{txt}                            Corrections {c |}{res}         42        2.01        9.71
{txt}                                DDR(RR) {c |}{res}         63        3.01       12.73
{txt}                               Demining {c |}{res}         10        0.48       13.21
{txt}                      Electoral Affairs {c |}{res}         54        2.58       15.79
{txt}                          Gender & SGBV {c |}{res}         95        4.55       20.33
{txt}                               HIV/AIDS {c |}{res}         73        3.49       23.83
{txt}                           Human Rights {c |}{res}        101        4.83       28.66
{txt}              Humanitarian Coordination {c |}{res}        109        5.22       33.88
{txt}    Information Collection and Analysis {c |}{res}         91        4.35       38.23
{txt}                    Internal Management {c |}{res}        150        7.18       45.41
{txt}                Justice and Rule of Law {c |}{res}        121        5.79       51.20
{txt}                      Political Affairs {c |}{res}        453       21.67       72.87
{txt}                Protection of Civilians {c |}{res}         53        2.54       75.41
{txt}Public Information and Strategic Comm.. {c |}{res}        142        6.79       82.20
{txt}                                    SSR {c |}{res}         30        1.44       83.64
{txt}                              Sanctions {c |}{res}          8        0.38       84.02
{txt}             Senior Civilian Leadership {c |}{res}         37        1.77       85.79
{txt}            Senior Uniformed Leadership {c |}{res}        267       12.78       98.56
{txt}    Stabilization (incl Early Recovery) {c |}{res}         30        1.44      100.00
{txt}{hline 40}{c +}{hline 35}
                                  Total {c |}{res}      2,090      100.00
{txt}
{com}. gen dem_posts_total=total if umbrella1=="Electoral Affairs" | umbrella1=="Political Affairs"
{txt}(1,583 missing values generated)

{com}. gen dem_intposts_total=international if umbrella1=="Electoral Affairs" | umbrella1=="Political Affairs"
{txt}(1,583 missing values generated)

{com}. gen dem_natposts_total=national if umbrella1=="Electoral Affairs" | umbrella1=="Political Affairs"
{txt}(1,583 missing values generated)

{com}. gen dem_posts_p=d2+p5p4+p3p2+p1 if umbrella1=="Electoral Affairs" | umbrella1=="Political Affairs"
{txt}(1,583 missing values generated)

{com}. gen dem_posts_nonp=total-(dem_posts_p) if umbrella1=="Electoral Affairs" | umbrella1=="Political Affairs"
{txt}(1,583 missing values generated)

{com}. 
. label var dem_posts_total "Total Democracy Posts"
{txt}
{com}. label var dem_intposts_total "International Democracy Posts"
{txt}
{com}. label var dem_natposts_total "National Democracy Posts"
{txt}
{com}. label var dem_posts_p "P-level Democracy Posts"
{txt}
{com}. label var dem_posts_nonp "Non-P Democracy Posts"
{txt}
{com}. 
. *Pick one mission when multiple to the same country
. drop if mission=="UNISFA" // pick UNMISS
{txt}(68 observations deleted)

{com}. drop if mission=="UNAMID" // pick UNMIS
{txt}(227 observations deleted)

{com}. 
. foreach var of varlist dem_dummy-dem_posts_nonp{c -(}
{txt}  2{com}.         replace `var'=0 if `var'==.
{txt}  3{com}. {c )-}
{txt}(0 real changes made)
(1,372 real changes made)
(1,372 real changes made)
(1,372 real changes made)
(1,372 real changes made)
(1,372 real changes made)

{com}. 
. collapse (max) dem_dummy (sum) dem_posts_nonp dem_posts_p dem_posts_total dem_intposts_total dem_natposts_total usgasg-national total international (first) country iso3n , by(cown year)
{res}{txt}
{com}. gen nondem_posts_total=total-dem_posts_total if dem_posts_total!=.
{txt}
{com}. replace nondem_posts_total=total if nondem_posts_total==. & (dem_posts_total!=. | dem_posts_total==0)
{txt}(0 real changes made)

{com}. label var nondem_posts_total "Total Non-Democracy Posts"
{txt}
{com}. 
. gen gwnoloc=cown
{txt}
{com}. *Add 2 years to year to match years correctly
. replace year=year+2
{txt}(96 real changes made)

{com}. xtset gwnoloc year
{res}
{col 1}{txt:Panel variable: }{res:gwnoloc}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:year}{txt:, }{res:{bind:1994}}{txt: to }{res:{bind:2018}}{txt:, but with gaps}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. save "BDSreplication/uncippo_democracy.dta", replace
{txt}{p 0 4 2}
file {bf}
BDSreplication/uncippo_democracy.dta{rm}
saved
{p_end}

{com}. 
. 
. use "BDSreplication/data.dta", clear
{txt}
{com}. do "BDSreplication/prepare_bds.do"
{txt}
{com}.         * Drop observations for Eritrea before 1993 and South Sudan before 2011
.         
.                 drop if gwnoloc==531 & year<1993
{txt}(33 observations deleted)

{com}.                 drop if gwnoloc==626 & year<2011
{txt}(51 observations deleted)

{com}. 
.                 
. 
.         * Generate lagged dependent variables
.                 
.                 sort gwnoloc year
{txt}
{com}.                 
.                 foreach x of varlist v2x_polyarchy polity2 fh_pr_rec democracy ///
>                         {c -(}
{txt}  2{com}.                 cap     gen `x'_1l=`x'[_n-1]
{txt}  3{com}.                 cap     gen `x'_2l=`x'[_n-2]
{txt}  4{com}.                 cap     gen `x'_3l=`x'[_n-3]
{txt}  5{com}.                 cap     gen `x'_4l=`x'[_n-4]
{txt}  6{com}.                 cap     gen `x'_5l=`x'[_n-5]
{txt}  7{com}.                         
.                         local lab: variable label `x'
{txt}  8{com}.                         
.                         la var `x'_1l "`lab' (1 yr lag)"
{txt}  9{com}.                         la var `x'_2l "`lab' (2 yr lag)"
{txt} 10{com}.                         la var `x'_3l "`lab' (3 yr lag)"
{txt} 11{com}.                         la var `x'_4l "`lab' (4 yr lag)"
{txt} 12{com}.                         la var `x'_5l "`lab' (5 yr lag)"
{txt} 13{com}.                         {c )-}
{txt}
{com}. 
.                         
.                         
.         * Divide personnel numbers by 1,000
. 
.         cap     gen itotal_compound_K = itotal_compound / 1000
{txt}
{com}.                         la var itotal_compound_K "\# of uniformed personnel (1K units)"
{txt}
{com}.                 
.         cap     gen iactual_civilian_total_K = iactual_civilian_total / 1000
{txt}
{com}.                         la var iactual_civilian_total_K "\# of civilian personnel (1K units)"
{txt}
{com}.         
.         
.         
.         * Generate lagged independent variables
.                 
.                 sort gwnoloc year
{txt}
{com}.                 
.                 foreach x of varlist ///
>                         itotal_compound_K iactual_civilian_total_K idemo_all_max_dum ivoters_all_max_dum iparties_all_max_dum iany_demo_all_max_dum iany_demo_rel_all_max_dum ielections_all_max_dum iall_demo_max ///
>                         iany_demo_engage_max_dum iany_demo_bypass_max_dum ipema_any_demo_assist_dum ipema_any_demo_rel_assist_dum ipema_any_demo_agg  iall_demo_engage_max iall_demo_bypass_max ///
>                                 {c -(}
{txt}  2{com}.                                 cap     gen `x'_1l=`x'[_n-1]
{txt}  3{com}.                                 cap     gen `x'_2l=`x'[_n-2]
{txt}  4{com}.                                 cap     gen `x'_3l=`x'[_n-3]
{txt}  5{com}.                                 cap     gen `x'_4l=`x'[_n-4]
{txt}  6{com}.                                         
.                                 local lab: variable label `x'
{txt}  7{com}.                                 
.                                 la var `x'_1l "`lab' (1 yr lag)"
{txt}  8{com}.                                 la var `x'_2l "`lab' (2 yr lag)"
{txt}  9{com}.                                 la var `x'_3l "`lab' (3 yr lag)"
{txt} 10{com}.                                 la var `x'_4l "`lab' (3 yr lag)"
{txt} 11{com}.                                 
.                                 {c )-}
{txt}
{com}. 
.                                 
.                 
.         * Set missing values on control variables to within-country means 
.                                 
.                 foreach x of varlist wdi_pop wdi_oda wdi_gdppc unhcr_ref_idp wdi_literacy wdi_fuel  {c -(}
{txt}  2{com}.                         bys gwnoloc: egen `x'_mean=mean(`x')
{txt}  3{com}.                 cap     gen i`x'=`x'
{txt}  4{com}.                 cap     replace i`x'=`x'_mean if `x'==.
{txt}  5{com}.                                 local lab: variable label `x'
{txt}  6{com}.                                 lab var i`x' "`lab' (missing = within-country mean)"
{txt}  7{com}.                                         drop `x'_mean
{txt}  8{com}.                         {c )-}
{txt}(590 missing values generated)
(590 missing values generated)
(590 missing values generated)
(590 missing values generated)
(649 missing values generated)
(598 missing values generated)

{com}. 
.                 
.                                         
.         * Generate lagged control variables
.                 
.                 sort gwnoloc year
{txt}
{com}.                                                         
.                 foreach x of varlist ///
>                         iwdi_pop iwdi_oda iwdi_gdppc iunhcr_ref_idp iwdi_literacy iwdi_fuel ///
>                         {c -(}
{txt}  2{com}.                 cap     gen `x'_2l=`x'[_n-2]
{txt}  3{com}.                 cap     gen `x'_3l=`x'[_n-3]
{txt}  4{com}.                 cap     gen `x'_4l=`x'[_n-4]
{txt}  5{com}.                 cap     gen `x'_5l=`x'[_n-5]
{txt}  6{com}.                 cap     gen `x'_6l=`x'[_n-6]
{txt}  7{com}. 
.                                 local lab: variable label `x'
{txt}  8{com}.                                 
.                                 la var `x'_2l "`lab' (2 yr lag)"
{txt}  9{com}.                                 la var `x'_3l "`lab' (3 yr lag)"
{txt} 10{com}.                                 la var `x'_4l "`lab' (4 yr lag)"
{txt} 11{com}.                                 la var `x'_5l "`lab' (5 yr lag)"
{txt} 12{com}.                                 la var `x'_6l "`lab' (5 yr lag)"
{txt} 13{com}. 
.                         {c )-}
{txt}
{com}. 
. 
. 
.         * Generate instruments
.                                                                 
.                 sort gwnoloc year
{txt}
{com}.                                                                 
.                 tab gwnoloc, gen(country_temp)

{txt}Gleditsch-W {c |}
ard country {c |}
      codes {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
        404 {c |}{res}         59        2.46        2.46
{txt}        420 {c |}{res}         59        2.46        4.93
{txt}        432 {c |}{res}         59        2.46        7.39
{txt}        433 {c |}{res}         59        2.46        9.86
{txt}        435 {c |}{res}         59        2.46       12.32
{txt}        436 {c |}{res}         59        2.46       14.79
{txt}        437 {c |}{res}         59        2.46       17.25
{txt}        438 {c |}{res}         59        2.46       19.72
{txt}        439 {c |}{res}         59        2.46       22.18
{txt}        450 {c |}{res}         59        2.46       24.64
{txt}        451 {c |}{res}         59        2.46       27.11
{txt}        452 {c |}{res}         59        2.46       29.57
{txt}        461 {c |}{res}         59        2.46       32.04
{txt}        471 {c |}{res}         59        2.46       34.50
{txt}        475 {c |}{res}         59        2.46       36.97
{txt}        481 {c |}{res}         59        2.46       39.43
{txt}        482 {c |}{res}         59        2.46       41.90
{txt}        483 {c |}{res}         59        2.46       44.36
{txt}        484 {c |}{res}         59        2.46       46.83
{txt}        490 {c |}{res}         59        2.46       49.29
{txt}        500 {c |}{res}         59        2.46       51.75
{txt}        501 {c |}{res}         59        2.46       54.22
{txt}        516 {c |}{res}         59        2.46       56.68
{txt}        517 {c |}{res}         59        2.46       59.15
{txt}        520 {c |}{res}         59        2.46       61.61
{txt}        522 {c |}{res}         59        2.46       64.08
{txt}        530 {c |}{res}         59        2.46       66.54
{txt}        531 {c |}{res}         26        1.09       67.63
{txt}        540 {c |}{res}         59        2.46       70.09
{txt}        541 {c |}{res}         59        2.46       72.56
{txt}        552 {c |}{res}         59        2.46       75.02
{txt}        560 {c |}{res}         59        2.46       77.49
{txt}        565 {c |}{res}         59        2.46       79.95
{txt}        570 {c |}{res}         59        2.46       82.41
{txt}        580 {c |}{res}         59        2.46       84.88
{txt}        581 {c |}{res}         59        2.46       87.34
{txt}        600 {c |}{res}         59        2.46       89.81
{txt}        615 {c |}{res}         59        2.46       92.27
{txt}        616 {c |}{res}         59        2.46       94.74
{txt}        620 {c |}{res}         59        2.46       97.20
{txt}        625 {c |}{res}         59        2.46       99.67
{txt}        626 {c |}{res}          8        0.33      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      2,394      100.00
{txt}
{com}.                 
.         cap     gen ianydemoallmaxdum = iany_demo_all_max_dum 
{txt}
{com}.         cap     gen ipemaanydemoassistdum = ipema_any_demo_assist_dum
{txt}
{com}.                                 
.                 foreach x of varlist ianydemoallmaxdum ipemaanydemoassistdum ///
>                         {c -(} 
{txt}  2{com}.         cap             gen `x'_iv = .
{txt}  3{com}.                         {c )-}
{txt}
{com}.                 
.                 foreach x of varlist ianydemoallmaxdum ipemaanydemoassistdum ///
>                         {c -(} 
{txt}  2{com}.                         foreach n of numlist 1/42 {c -(}
{txt}  3{com}.                                 bys year: egen `x'_`n'=mean(`x') if country_temp`n'!=1
{txt}  4{com}.                                 bys year: replace `x'_`n'=-1 if country_temp`n'==1
{txt}  5{com}.                                 bys year: egen `x'_`n'_max=max(`x'_`n') if `x'_`n'!=.
{txt}  6{com}.                                 {c )-}
{txt}  7{com}. 
.                         foreach n of numlist 1/42 {c -(}
{txt}  8{com}.                                 bys year: replace `x'_iv=`x'_`n'_max if country_temp`n'==1
{txt}  9{com}.                                 {c )-}                                               
{txt} 10{com}.                         {c )-}       
{txt}(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,268 missing values generated)
(26 real changes made)
(1,242 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,250 missing values generated)
(8 real changes made)
(1,242 missing values generated)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(26 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(8 real changes made)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,268 missing values generated)
(26 real changes made)
(1,242 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,272 missing values generated)
(59 real changes made)
(1,213 missing values generated)
(1,250 missing values generated)
(8 real changes made)
(1,242 missing values generated)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(26 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(59 real changes made)
(8 real changes made)

{com}.                                         
.                 foreach x of varlist ianydemoallmaxdum ipemaanydemoassistdum ///
>                         {c -(} 
{txt}  2{com}.                                 drop `x'_1 - `x'_42_max         
{txt}  3{com}.                         {c )-}                       
{txt}
{com}.                                         
.                 foreach x of varlist ianydemoallmaxdum ipemaanydemoassistdum ///
>                         {c -(} 
{txt}  2{com}.                         foreach n of numlist 1/42 {c -(}
{txt}  3{com}.                                 bys year: egen `x'_`n'=mean(`x') if country_temp`n'!=1 & pko_p4p==1
{txt}  4{com}.                                 bys year: replace `x'_`n'=-1 if country_temp`n'==1
{txt}  5{com}.                                 bys year: egen `x'_`n'_max=max(`x'_`n') if `x'_`n'!=.
{txt}  6{com}.                                 {c )-}
{txt}  7{com}.                         {c )-}
{txt}(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,262 missing values generated)
(59 real changes made)
(2,203 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,272 missing values generated)
(59 real changes made)
(2,213 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,277 missing values generated)
(59 real changes made)
(2,218 missing values generated)
(2,269 missing values generated)
(59 real changes made)
(2,210 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,264 missing values generated)
(59 real changes made)
(2,205 missing values generated)
(2,262 missing values generated)
(59 real changes made)
(2,203 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,276 missing values generated)
(59 real changes made)
(2,217 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,267 missing values generated)
(59 real changes made)
(2,208 missing values generated)
(2,262 missing values generated)
(59 real changes made)
(2,203 missing values generated)
(2,263 missing values generated)
(59 real changes made)
(2,204 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,267 missing values generated)
(26 real changes made)
(2,241 missing values generated)
(2,271 missing values generated)
(59 real changes made)
(2,212 missing values generated)
(2,260 missing values generated)
(59 real changes made)
(2,201 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,270 missing values generated)
(59 real changes made)
(2,211 missing values generated)
(2,264 missing values generated)
(8 real changes made)
(2,256 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,262 missing values generated)
(59 real changes made)
(2,203 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,272 missing values generated)
(59 real changes made)
(2,213 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,277 missing values generated)
(59 real changes made)
(2,218 missing values generated)
(2,269 missing values generated)
(59 real changes made)
(2,210 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,264 missing values generated)
(59 real changes made)
(2,205 missing values generated)
(2,262 missing values generated)
(59 real changes made)
(2,203 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,276 missing values generated)
(59 real changes made)
(2,217 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,267 missing values generated)
(59 real changes made)
(2,208 missing values generated)
(2,262 missing values generated)
(59 real changes made)
(2,203 missing values generated)
(2,263 missing values generated)
(59 real changes made)
(2,204 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,267 missing values generated)
(26 real changes made)
(2,241 missing values generated)
(2,271 missing values generated)
(59 real changes made)
(2,212 missing values generated)
(2,260 missing values generated)
(59 real changes made)
(2,201 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,258 missing values generated)
(59 real changes made)
(2,199 missing values generated)
(2,270 missing values generated)
(59 real changes made)
(2,211 missing values generated)
(2,264 missing values generated)
(8 real changes made)
(2,256 missing values generated)

{com}.                         
.                 foreach x of varlist ianydemoallmaxdum ipemaanydemoassistdum ///
>                         {c -(} 
{txt}  2{com}.                                 drop `x'_1 - `x'_42_max         
{txt}  3{com}.                                 replace `x'_iv = . if `x'_iv == -1
{txt}  4{com}.                         {c )-}       
{txt}(1,244 real changes made, 1,244 to missing)
(1,244 real changes made, 1,244 to missing)

{com}.                         
.                         drop ianydemoallmaxdum ipemaanydemoassistdum
{txt}
{com}.                         
.                 cap     ren ianydemoallmaxdum_iv iany_demo_all_maxdiv
{txt}
{com}.                 cap     ren ipemaanydemoassistdum_iv ipema_any_demo_assdiv
{txt}
{com}. 
.                         drop country_temp*
{txt}
{com}.                                 
.                         la var iany_demo_all_maxdiv "\% democracy activities in other missions" 
{txt}
{com}.                         la var ipema_any_demo_assdiv "\% democracy mandate components in other missions" 
{txt}
{com}.                                                         
.                                                         
.                                 
.         * Generate lagged instruments
. 
.                 sort gwnoloc year
{txt}
{com}. 
.                 foreach x of varlist ///
>                         iany_demo_all_maxdiv ipema_any_demo_assdiv ///          
>                                 {c -(}
{txt}  2{com}.                         cap             gen `x'_1l=`x'[_n-1]
{txt}  3{com}.                         cap             gen `x'_2l=`x'[_n-2]
{txt}  4{com}.                         cap             gen `x'_3l=`x'[_n-2]
{txt}  5{com}.                                         
.                                         local lab: variable label `x'
{txt}  6{com}.                                 
.                                         la var `x'_1l "`lab' (1 yr lag)"
{txt}  7{com}.                                         la var `x'_2l "`lab' (2 yr lag)"
{txt}  8{com}.                                         la var `x'_3l "`lab' (3 yr lag)"
{txt}  9{com}.                                 {c )-}
{txt}
{com}. 
.                         
.                                                                         
.         * Generate dummies for conflict and post-conflict samples
. 
.         cap     gen ucdp_0yrs=ucdp
{txt}
{com}.         
.         cap     gen ucdp_1yrs=0
{txt}
{com}.                         bys gwnoloc: replace ucdp_1yrs=. if ucdp_ever==0
{txt}(0 real changes made)

{com}.                         bys gwnoloc: replace ucdp_1yrs=1 if year>=ucdp_end_alt+1
{txt}(1,845 real changes made)

{com}.                         bys gwnoloc: replace ucdp_1yrs=0 if ucdp==1
{txt}(0 real changes made)

{com}.         
.                 cap gen ucdp_2yrs=0
{txt}
{com}.                         bys gwnoloc: replace ucdp_2yrs=. if ucdp_ever==0
{txt}(0 real changes made)

{com}.                         bys gwnoloc: replace ucdp_2yrs=1 if year>=ucdp_end_alt+2
{txt}(1,739 real changes made)

{com}.                         bys gwnoloc: replace ucdp_2yrs=0 if ucdp==1
{txt}(0 real changes made)

{com}. 
.         cap     gen ucdp_3yrs=0
{txt}
{com}.                         bys gwnoloc: replace ucdp_3yrs=. if ucdp_ever==0
{txt}(0 real changes made)

{com}.                         bys gwnoloc: replace ucdp_3yrs=1 if year>=ucdp_end_alt+3
{txt}(1,665 real changes made)

{com}.                         bys gwnoloc: replace ucdp_3yrs=0 if ucdp==1
{txt}(0 real changes made)

{com}. 
.                 bys gwnoloc: egen ucdp_first_start_alt = min(ucdp_start_alt) if ucdp_start_alt!=.
{txt}(864 missing values generated)

{com}.                 
.                 foreach n of numlist 1 2 3 {c -(}
{txt}  2{com}.                         replace ucdp_`n'yrs = . if year<ucdp_first_start_alt
{txt}  3{com}.                 {c )-}
{txt}(864 real changes made, 864 to missing)
(864 real changes made, 864 to missing)
(864 real changes made, 864 to missing)

{com}. 
.                 drop ucdp_first_start_alt
{txt}
{com}.                 
.                 la var ucdp_0yrs "In armed conflict (UCDP)"
{txt}
{com}.                 la var ucdp_1yrs "One year after end of armed conflict (UCDP)"
{txt}
{com}.                 la var ucdp_2yrs "Two years after end of armed conflict (UCDP)"
{txt}
{com}.                 la var ucdp_3yrs "Three years after end of armed conflict (UCDP)"
{txt}
{com}.                         
.                         
.         
.         * Generate interaction terms
.         
.                 foreach x in itotal_compound_K iactual_civilian_total_K iany_demo_all_max_dum {c -(}
{txt}  2{com}.         cap             gen ipema_`x'=ipema_any_demo_assist_dum_2l * `x'_2l
{txt}  3{com}.                 {c )-}
{txt}
{com}.         
.                 foreach x in iactual_civilian_total_K iany_demo_all_max_dum {c -(}
{txt}  2{com}.         cap             gen itotal_`x'=itotal_compound_K_2l * `x'_2l
{txt}  3{com}.                 {c )-}
{txt}
{com}.         
.         cap     gen iany_iactual_civilian_total_K = iany_demo_all_max_dum_2l * iactual_civilian_total_K_2l
{txt}
{com}.         
.                 la var ipema_itotal_compound_K "Democracy mandate $\times$ \# of uniformed personnel"
{txt}
{com}.                 la var ipema_iactual_civilian_total_K "Democracy mandate $\times$ \# of civilian personnel"
{txt}
{com}.                 la var ipema_iany_demo_all_max_dum "Dmocracy mandate $\times$ any democracy activities"
{txt}
{com}.                 
.                 la var itotal_iactual_civilian_total_K "\# of uniformed personnel $\times$ \# of civilian personnel"
{txt}
{com}.                 la var itotal_iany_demo_all_max_dum "\# of uniformed personnel $\times$ any democracy activities"
{txt}
{com}.                 
.                 la var iany_iactual_civilian_total_K "Any democracy activities $\times$ \# of civilian personnel"
{txt}
{com}.                 
.         
.         
.         
.         * Generate version of uniformed personnel for country-years with data on civilian personnel
.                 
.         cap     gen itotal_compound_K_2l_civ = itotal_compound_K_2l
{txt}
{com}.                         replace itotal_compound_K_2l_civ=. if iactual_civilian_total_K_2l==.
{txt}(395 real changes made, 395 to missing)

{com}.                         la var itotal_compound_K_2l_civ "\# of uniformed personnel (restricted sample)"
{txt}
{com}. 
.         
.         
.         
.         * Code changes in number of democracy mandate components over time
.                 
.         cap     gen ipema_any_demo_more_2l = 0
{txt}
{com}.                         replace ipema_any_demo_more_2l = 1 if ipema_any_demo_agg_2l>ipema_any_demo_agg_3l & ipema_any_demo_agg_2l!=. & ipema_any_demo_agg_3l!=.
{txt}(22 real changes made)

{com}. 
.                         la var ipema_any_demo_more_2l "More democracy mandate components than previous year (2 yr lag)"
{txt}
{com}.                         
.         cap     gen ipema_any_demo_less_2l = 0
{txt}
{com}.                         replace ipema_any_demo_less_2l = 1 if ipema_any_demo_agg_2l<ipema_any_demo_agg_3l & ipema_any_demo_agg_2l!=. & ipema_any_demo_agg_3l!=.
{txt}(11 real changes made)

{com}. 
.                         la var ipema_any_demo_less_2l "Fewer democracy mandate components than previous year (2 yr lag)"
{txt}
{com}. 
.         cap     gen ipema_any_demo_diff_2l = ipema_any_demo_agg_2l-ipema_any_demo_agg_3l
{txt}
{com}.         cap             gen ipema_any_demo_diff=ipema_any_demo_diff_2l[_n+2]
{txt}
{com}.                         
.                         la var ipema_any_demo_diff "Change in \# of mandated democracy tasks from previous year"
{txt}
{com}.                         la var ipema_any_demo_diff_2l "Change in \# of mandated democracy tasks from previous year (2 yr lag)"
{txt}
{com}.                                 
. 
.         
.         
.         * Relabel variables for parsimony in tables and figures
.         
.                 la var v2x_polyarchy_2l "Electoral democracy (V-Dem)"
{txt}
{com}.                 la var v2x_polyarchy_3l "Electoral democracy (V-Dem, lagged)"
{txt}
{com}.                 la var v2x_polyarchy_4l "Electoral democracy (V-Dem, +2 lags)"
{txt}
{com}.                 
.                 la var iany_demo_all_max_dum_2l "Any democracy activities"
{txt}
{com}.                 la var iany_demo_all_max_dum_3l "Any democracy activities (+1 lag)"
{txt}
{com}.                 la var iany_demo_all_max_dum_4l "Any democracy activities (+2 lags)"
{txt}
{com}.                 
.                 la var iany_demo_rel_all_max_dum_2l "Any democracy-related activities"
{txt}
{com}.                 la var iall_demo_max_2l  "\# of distinct democracy activities"
{txt}
{com}.                 la var idemo_all_max_dum_2l "Any democratic institution activities"
{txt}
{com}.                 la var ielections_all_max_dum_2l "Any election activities"
{txt}
{com}.                 la var iparties_all_max_dum_2l "Any political party activities"
{txt}
{com}.                 la var ivoters_all_max_dum_2l "Any voter activities"
{txt}
{com}.                 
.                 la var iany_demo_engage_max_dum_2l "Any democracy engagement with host state"
{txt}
{com}.                 la var iany_demo_bypass_max_dum_2l "Any democracy bypassing of host state"
{txt}
{com}.                 
.                 la var iall_demo_engage_max_2l "# of distinct democracy activities engaging host state"
{txt}
{com}.                 la var iall_demo_bypass_max_2l "# of distinct democracy activities bypassing host state"
{txt}
{com}.                                 
.                 la var ipema_any_demo_assist_dum_2l "Democracy mandate"
{txt}
{com}.                 la var ipema_any_demo_assist_dum_3l "Democracy mandate (+1 lag)"
{txt}
{com}.                 la var ipema_any_demo_assist_dum_4l "Democracy mandate (+2 lags)"
{txt}
{com}.                 
.                 la var ipema_any_demo_rel_assist_dum_2l "Democracy-related mandate"
{txt}
{com}.                 
.                 la var ipema_any_demo_assdiv_2l "\% democracy mandates in other missions" 
{txt}
{com}.                                 
.                 la var ipema_any_demo_diff_2l "Change in \# of mandated democracy tasks from previous year"
{txt}
{com}.                 la var ipema_any_demo_agg_2l "\# of distinct democracy tasks in mandate"
{txt}
{com}.                 
.                 la var iactual_civilian_total_K_2l "\# of civilian personnel"
{txt}
{com}.                 la var iactual_civilian_total_K_3l "\# of civilian personnel (+1 lag)"
{txt}
{com}.                 la var iactual_civilian_total_K_4l "\# of civilian personnel (+2 lags)"
{txt}
{com}.                                 
.                 la var itotal_compound_K_2l "\# of uniformed personnel"
{txt}
{com}.                 la var itotal_compound_K_3l "\# of uniformed personnel (+1 lag)"
{txt}
{com}.                 la var itotal_compound_K_4l "\# of uniformed personnel (+2 lags)"
{txt}
{com}.                 
.                 la var itotal_compound_K_2l_civ "\# of uniformed personnel (restricted sample)"
{txt}
{com}.                                 
.                 la var iwdi_pop_3l "Population"
{txt}
{com}.                 la var iwdi_oda_3l "Foreign aid"
{txt}
{com}.                 la var iwdi_gdppc_3l "GDP per capita"
{txt}
{com}.                 la var iunhcr_ref_idp_3l "Refugees"
{txt}
{com}.                 la var iwdi_literacy_3l "Literacy"
{txt}
{com}.                 la var iwdi_fuel_3l "Fuel exports"
{txt}
{com}.                 
.                 la var iwdi_pop_4l "Population (+1 lag)"
{txt}
{com}.                 la var iwdi_oda_4l "Foreign aid (+1 lag)"
{txt}
{com}.                 la var iwdi_gdppc_4l "GDP per capita (+1 lag)"
{txt}
{com}.                 la var iunhcr_ref_idp_4l "Refugees (+1 lag)"
{txt}
{com}.                 la var iwdi_literacy_4l "Literacy (+1 lag)"
{txt}
{com}.                 la var iwdi_fuel_4l "Fuel exports (+1 lag)"
{txt}
{com}. 
.                 la var iwdi_pop_5l "Population (+2 lags)"
{txt}
{com}.                 la var iwdi_oda_5l "Foreign aid (+2 lags)"
{txt}
{com}.                 la var iwdi_gdppc_5l "GDP per capita (+2 lags)"
{txt}
{com}.                 la var iunhcr_ref_idp_5l "Refugees (+2 lags)"
{txt}
{com}.                 la var iwdi_literacy_5l "Literacy (+2 lags)"
{txt}
{com}.                 la var iwdi_fuel_5l "Fuel exports (+2 lags)"
{txt}
{com}. 
.         
.         
.         
.         * Drop observations before 1991 (accounting for lags)
.         
.                 drop if year<1991
{txt}(1,240 observations deleted)

{com}.         
.         
.         
.         
.         * Set globals
.                         
.                 gl ictrls_2l_varying iwdi_pop_2l iwdi_oda_2l iwdi_gdppc_2l iunhcr_ref_idp_2l iwdi_literacy_2l iwdi_fuel_2l 
{txt}
{com}. 
.                 gl ictrls_3l_varying iwdi_pop_3l iwdi_oda_3l iwdi_gdppc_3l iunhcr_ref_idp_3l iwdi_literacy_3l iwdi_fuel_3l
{txt}
{com}. 
.                 gl ictrls_4l_varying iwdi_pop_4l iwdi_oda_4l iwdi_gdppc_4l iunhcr_ref_idp_4l iwdi_literacy_4l iwdi_fuel_4l
{txt}
{com}. 
.                 gl ictrls_5l_varying iwdi_pop_5l iwdi_oda_5l iwdi_gdppc_5l iunhcr_ref_idp_5l iwdi_literacy_5l iwdi_fuel_5l
{txt}
{com}. 
{txt}end of do-file

{com}. 
. merge 1:1 gwnoloc year using "BDSreplication/uncippo_democracy.dta"
{res}{txt}{p 0 7 2}
(variable
{bf:country} was {bf:str32}, now {bf:str137} to accommodate using data's values)
{p_end}

{col 5}Result{col 33}Number of obs
{col 5}{hline 41}
{col 5}Not matched{col 30}{res}           1,058
{txt}{col 9}from master{col 30}{res}           1,058{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}Matched{col 30}{res}              96{txt}  (_merge==3)
{col 5}{hline 41}

{com}. tab country if _m==1

                                {txt}Country {c |}      Freq.     Percent        Cum.
{hline 40}{c +}{hline 35}
                                Algeria {c |}{res}         28        3.60        3.60
{txt}                                 Angola {c |}{res}         23        2.96        6.56
{txt}                                Burundi {c |}{res}         25        3.21        9.77
{txt}               Central African Republic {c |}{res}         19        2.44       12.21
{txt}                                   Chad {c |}{res}         28        3.60       15.81
{txt}                                Comoros {c |}{res}         28        3.60       19.41
{txt}                          Cote d'Ivoire {c |}{res}         15        1.93       21.34
{txt}       Democratic Republic of the Congo {c |}{res}         12        1.54       22.88
{txt}                               Djibouti {c |}{res}         28        3.60       26.48
{txt}                                Eritrea {c |}{res}         19        2.44       28.92
{txt}                               Ethiopia {c |}{res}         28        3.60       32.52
{txt}                                 Guinea {c |}{res}         28        3.60       36.12
{txt}                          Guinea-Bissau {c |}{res}         28        3.60       39.72
{txt}                                Lesotho {c |}{res}         28        3.60       43.32
{txt}                                Liberia {c |}{res}          9        1.16       44.47
{txt}                                  Libya {c |}{res}         28        3.60       48.07
{txt}                                   Mali {c |}{res}         25        3.21       51.29
{txt}                             Mauritania {c |}{res}         28        3.60       54.88
{txt}                                Morocco {c |}{res}         28        3.60       58.48
{txt}                             Mozambique {c |}{res}         28        3.60       62.08
{txt}                                Namibia {c |}{res}         28        3.60       65.68
{txt}                                  Niger {c |}{res}         28        3.60       69.28
{txt}                                Nigeria {c |}{res}         28        3.60       72.88
{txt}                  Republic of the Congo {c |}{res}         28        3.60       76.48
{txt}                                 Rwanda {c |}{res}         27        3.47       79.95
{txt}                                Senegal {c |}{res}         28        3.60       83.55
{txt}                           Sierra Leone {c |}{res}         22        2.83       86.38
{txt}                                Somalia {c |}{res}         26        3.34       89.72
{txt}                            South Sudan {c |}{res}          2        0.26       89.97
{txt}                                  Sudan {c |}{res}         22        2.83       92.80
{txt}                                   Togo {c |}{res}         28        3.60       96.40
{txt}                                 Uganda {c |}{res}         28        3.60      100.00
{txt}{hline 40}{c +}{hline 35}
                                  Total {c |}{res}        778      100.00
{txt}
{com}. foreach var of varlist dem_dummy-internationalstaff{c -(}
{txt}  2{com}.         replace `var'=0 if `var'==. & _m==1 & iactual_civilian_total!=.
{txt}  3{com}. {c )-}
{txt}(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)
(667 real changes made)

{com}. 
. *start from 1993 as in BDS
. foreach var of varlist dem_dummy-internationalstaff{c -(}
{txt}  2{com}.         replace `var'=. if year<=1992 | year>2017
{txt}  3{com}. {c )-}
{txt}(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)
(6 real changes made, 6 to missing)

{com}.  
. drop _m
{txt}
{com}. 
. xtset gw year
{res}
{col 1}{txt:Panel variable: }{res:gwnoloc}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:year}{txt:, }{res:{bind:1991}}{txt: to }{res:{bind:2018}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. la var iactual_civilian_total_K "BDS \# of civilian personnel (1K units)"
{txt}
{com}. 
. *Transform uncippo to compare
. gen total_K=total/1000
{txt}(397 missing values generated)

{com}. gen international_K=international/1000
{txt}(397 missing values generated)

{com}. gen national_K=nationalst/1000
{txt}(397 missing values generated)

{com}. 
. gen nondemposts_K=nondem_posts_total/1000
{txt}(1,058 missing values generated)

{com}. gen demposts_K=dem_posts_total/1000
{txt}(397 missing values generated)

{com}. gen demint_K=dem_intposts_total/1000
{txt}(397 missing values generated)

{com}. gen demnat_K=dem_natposts_total/1000
{txt}(397 missing values generated)

{com}. gen demp_K=dem_posts_p/1000
{txt}(397 missing values generated)

{com}. gen demnotp_K=dem_posts_nonp/1000
{txt}(397 missing values generated)

{com}. gen nondemnonp_K=total_K-(demp_K + demnotp_K)
{txt}(397 missing values generated)

{com}. 
. foreach var of varlist total_K-nondemnonp_K{c -(}
{txt}  2{com}.         replace `var'=0 if `var'==.
{txt}  3{com}. {c )-}
{txt}(397 real changes made)
(397 real changes made)
(397 real changes made)
(1,058 real changes made)
(397 real changes made)
(397 real changes made)
(397 real changes made)
(397 real changes made)
(397 real changes made)
(397 real changes made)

{com}. 
. la var total_K "UNCiPPO \# of civilian personnel (1K units)"
{txt}
{com}. corr total_K iactual_civilian_total_K // 0.76 correlation
{txt}(obs=757)

             {c |}  total_K iactua~K
{hline 13}{c +}{hline 18}
     total_K {c |}{res}   1.0000
{txt}iactual_ci~K {c |}{res}   0.8668   1.0000

{txt}
{com}. 
. br country year total_K iactual_civilian_total_K
{txt}
{com}.                         
. xtset gw year
{res}
{col 1}{txt:Panel variable: }{res:gwnoloc}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:year}{txt:, }{res:{bind:1991}}{txt: to }{res:{bind:2018}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. label var total_K "UNCiPPO Total"
{txt}
{com}. label var iactual_civilian_total_K "BDS' Total"
{txt}
{com}. 
. *Replication with BDS's code
. *globals
. gl ictrls_3l_varying iwdi_pop_3l iwdi_oda_3l iwdi_gdppc_3l iunhcr_ref_idp_3l iwdi_literacy_3l iwdi_fuel_3l
{txt}
{com}. xtset gwnoloc year
{res}
{col 1}{txt:Panel variable: }{res:gwnoloc}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:year}{txt:, }{res:{bind:1991}}{txt: to }{res:{bind:2018}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. 
. *FIGURE 9
. eststo clear
{txt}
{com}. eststo: xtreg v2x_polyarchy  l2.total_K $ictrls_3l_varying, fe
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res}       778
{txt}Group variable: {res}gwnoloc{txt}{col 49}Number of groups{col 67}={col 69}{res}        31

{txt}R-squared:{col 49}Obs per group:
     Within  = {res}0.1750{col 63}{txt}min{col 67}={col 69}{res}         1
{txt}     Between = {res}0.0145{col 63}{txt}avg{col 67}={col 69}{res}      25.1
{txt}     Overall = {res}0.0012{col 63}{txt}max{col 67}={col 69}{res}        26

{txt}{col 49}F({res}7{txt}, {res}740{txt}){col 67}={col 70}{res}    22.42
{txt}corr(u_i, Xb) = {res}-0.5901{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}v2x_polyar~y{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 5}total_K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2} .1186962{col 26}{space 2} .0201852{col 37}{space 1}    5.88{col 46}{space 3}0.000{col 54}{space 4} .0790691{col 67}{space 3} .1583233
{txt}{space 12} {c |}
{space 1}iwdi_pop_3l {c |}{col 14}{res}{space 2} 3.22e-09{col 26}{space 2} 5.34e-10{col 37}{space 1}    6.03{col 46}{space 3}0.000{col 54}{space 4} 2.17e-09{col 67}{space 3} 4.27e-09
{txt}{space 1}iwdi_oda_3l {c |}{col 14}{res}{space 2}-5.53e-12{col 26}{space 2} 5.56e-12{col 37}{space 1}   -1.00{col 46}{space 3}0.320{col 54}{space 4}-1.64e-11{col 67}{space 3} 5.38e-12
{txt}iwdi_gdpp~3l {c |}{col 14}{res}{space 2} .0000217{col 26}{space 2} 3.90e-06{col 37}{space 1}    5.55{col 46}{space 3}0.000{col 54}{space 4}  .000014{col 67}{space 3} .0000293
{txt}iunhcr_re~3l {c |}{col 14}{res}{space 2}-3.91e-08{col 26}{space 2} 1.05e-08{col 37}{space 1}   -3.73{col 46}{space 3}0.000{col 54}{space 4}-5.97e-08{col 67}{space 3}-1.85e-08
{txt}iwdi_lite~3l {c |}{col 14}{res}{space 2} .0004232{col 26}{space 2} .0012384{col 37}{space 1}    0.34{col 46}{space 3}0.733{col 54}{space 4} -.002008{col 67}{space 3} .0028544
{txt}iwdi_fuel_3l {c |}{col 14}{res}{space 2} .0003034{col 26}{space 2} .0003746{col 37}{space 1}    0.81{col 46}{space 3}0.418{col 54}{space 4} -.000432{col 67}{space 3} .0010388
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2512049{col 26}{space 2} .0647637{col 37}{space 1}    3.88{col 46}{space 3}0.000{col 54}{space 4} .1240625{col 67}{space 3} .3783473
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
     sigma_u {c |} {res} .18504543
     {txt}sigma_e {c |} {res} .08061879
         {txt}rho {c |} {res} .84047132{txt}   (fraction of variance due to u_i)
{hline 13}{c BT}{hline 64}
F test that all u_i=0: F({res}30{txt}, {res}740{txt}) = {res}73.98{col 62}{txt}Prob > F = {res}0.0000
{txt}({res}est1{txt} stored)

{com}. eststo: xtreg v2x_polyarchy  l2.international_K l2.national_K $ictrls_3l_varying, fe
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res}       778
{txt}Group variable: {res}gwnoloc{txt}{col 49}Number of groups{col 67}={col 69}{res}        31

{txt}R-squared:{col 49}Obs per group:
     Within  = {res}0.2300{col 63}{txt}min{col 67}={col 69}{res}         1
{txt}     Between = {res}0.0174{col 63}{txt}avg{col 67}={col 69}{res}      25.1
{txt}     Overall = {res}0.0004{col 63}{txt}max{col 67}={col 69}{res}        26

{txt}{col 49}F({res}8{txt}, {res}739{txt}){col 67}={col 70}{res}    27.60
{txt}corr(u_i, Xb) = {res}-0.5941{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}v2x_polyar~y{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
internatio~K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2} .6492372{col 26}{space 2} .0751161{col 37}{space 1}    8.64{col 46}{space 3}0.000{col 54}{space 4} .5017708{col 67}{space 3} .7967036
{txt}{space 12} {c |}
{space 2}national_K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2}-.3576104{col 26}{space 2} .0678091{col 37}{space 1}   -5.27{col 46}{space 3}0.000{col 54}{space 4}-.4907319{col 67}{space 3}-.2244889
{txt}{space 12} {c |}
{space 1}iwdi_pop_3l {c |}{col 14}{res}{space 2} 3.14e-09{col 26}{space 2} 5.16e-10{col 37}{space 1}    6.09{col 46}{space 3}0.000{col 54}{space 4} 2.13e-09{col 67}{space 3} 4.15e-09
{txt}{space 1}iwdi_oda_3l {c |}{col 14}{res}{space 2}-9.45e-12{col 26}{space 2} 5.40e-12{col 37}{space 1}   -1.75{col 46}{space 3}0.081{col 54}{space 4}-2.00e-11{col 67}{space 3} 1.15e-12
{txt}iwdi_gdpp~3l {c |}{col 14}{res}{space 2}  .000023{col 26}{space 2} 3.78e-06{col 37}{space 1}    6.10{col 46}{space 3}0.000{col 54}{space 4} .0000156{col 67}{space 3} .0000305
{txt}iunhcr_re~3l {c |}{col 14}{res}{space 2}-3.39e-08{col 26}{space 2} 1.02e-08{col 37}{space 1}   -3.34{col 46}{space 3}0.001{col 54}{space 4}-5.39e-08{col 67}{space 3}-1.40e-08
{txt}iwdi_lite~3l {c |}{col 14}{res}{space 2} .0002039{col 26}{space 2} .0011976{col 37}{space 1}    0.17{col 46}{space 3}0.865{col 54}{space 4}-.0021471{col 67}{space 3}  .002555
{txt}iwdi_fuel_3l {c |}{col 14}{res}{space 2} .0005483{col 26}{space 2} .0003637{col 37}{space 1}    1.51{col 46}{space 3}0.132{col 54}{space 4}-.0001657{col 67}{space 3} .0012622
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2558715{col 26}{space 2} .0626131{col 37}{space 1}    4.09{col 46}{space 3}0.000{col 54}{space 4} .1329508{col 67}{space 3} .3787923
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
     sigma_u {c |} {res}  .1876678
     {txt}sigma_e {c |} {res} .07793518
         {txt}rho {c |} {res}  .8529078{txt}   (fraction of variance due to u_i)
{hline 13}{c BT}{hline 64}
F test that all u_i=0: F({res}30{txt}, {res}739{txt}) = {res}80.03{col 62}{txt}Prob > F = {res}0.0000
{txt}({res}est2{txt} stored)

{com}. coefplot est1, keep(*total_K ) xline(0) legend(off) xscale(range(-0.01 .)) ylabel(1 "UNCiPPO Tot. Civilian Posts")
{res}{p 0 4 2}
{txt}(note:  named style
thin not found in class
linestyle,  default attributes used)
{p_end}
{res}{txt}
{com}. coefplot est2, keep(*international* *national*) xline(0) legend(off) xscale(range(-0.0001 .)) ylabel(1 "UNCiPPO Int. Civilian Posts" 2 "UNCiPPO Nat. Civilian Posts")
{res}{txt}
{com}. 
. *FIGURE 10
. eststo clear
{txt}
{com}. eststo: xtreg v2x_polyarchy  l2.dem_dummy $ictrls_3l_varying, fe
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res}       697
{txt}Group variable: {res}gwnoloc{txt}{col 49}Number of groups{col 67}={col 69}{res}        30

{txt}R-squared:{col 49}Obs per group:
     Within  = {res}0.1673{col 63}{txt}min{col 67}={col 69}{res}         1
{txt}     Between = {res}0.0156{col 63}{txt}avg{col 67}={col 69}{res}      23.2
{txt}     Overall = {res}0.0019{col 63}{txt}max{col 67}={col 69}{res}        24

{txt}{col 49}F({res}7{txt}, {res}660{txt}){col 67}={col 70}{res}    18.95
{txt}corr(u_i, Xb) = {res}-0.5613{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}v2x_polyar~y{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}dem_dummy {c |}
{space 9}L2. {c |}{col 14}{res}{space 2} .0639942{col 26}{space 2} .0116578{col 37}{space 1}    5.49{col 46}{space 3}0.000{col 54}{space 4} .0411034{col 67}{space 3} .0868849
{txt}{space 12} {c |}
{space 1}iwdi_pop_3l {c |}{col 14}{res}{space 2} 2.80e-09{col 26}{space 2} 5.49e-10{col 37}{space 1}    5.10{col 46}{space 3}0.000{col 54}{space 4} 1.72e-09{col 67}{space 3} 3.88e-09
{txt}{space 1}iwdi_oda_3l {c |}{col 14}{res}{space 2}-2.96e-12{col 26}{space 2} 5.27e-12{col 37}{space 1}   -0.56{col 46}{space 3}0.575{col 54}{space 4}-1.33e-11{col 67}{space 3} 7.39e-12
{txt}iwdi_gdpp~3l {c |}{col 14}{res}{space 2} .0000205{col 26}{space 2} 3.77e-06{col 37}{space 1}    5.44{col 46}{space 3}0.000{col 54}{space 4} .0000131{col 67}{space 3} .0000279
{txt}iunhcr_re~3l {c |}{col 14}{res}{space 2}-2.66e-08{col 26}{space 2} 9.86e-09{col 37}{space 1}   -2.70{col 46}{space 3}0.007{col 54}{space 4}-4.60e-08{col 67}{space 3}-7.22e-09
{txt}iwdi_lite~3l {c |}{col 14}{res}{space 2}-.0005559{col 26}{space 2} .0012543{col 37}{space 1}   -0.44{col 46}{space 3}0.658{col 54}{space 4}-.0030188{col 67}{space 3} .0019069
{txt}iwdi_fuel_3l {c |}{col 14}{res}{space 2} .0006552{col 26}{space 2} .0003559{col 37}{space 1}    1.84{col 46}{space 3}0.066{col 54}{space 4}-.0000435{col 67}{space 3} .0013539
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2987101{col 26}{space 2} .0656658{col 37}{space 1}    4.55{col 46}{space 3}0.000{col 54}{space 4}  .169771{col 67}{space 3} .4276492
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
     sigma_u {c |} {res} .18611695
     {txt}sigma_e {c |} {res} .07656421
         {txt}rho {c |} {res} .85526305{txt}   (fraction of variance due to u_i)
{hline 13}{c BT}{hline 64}
F test that all u_i=0: F({res}29{txt}, {res}660{txt}) = {res}83.25{col 62}{txt}Prob > F = {res}0.0000
{txt}({res}est1{txt} stored)

{com}. eststo: xtreg v2x_polyarchy  l2.demposts_K l2.nondemposts_K $ictrls_3l_varying, fe
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res}       778
{txt}Group variable: {res}gwnoloc{txt}{col 49}Number of groups{col 67}={col 69}{res}        31

{txt}R-squared:{col 49}Obs per group:
     Within  = {res}0.1795{col 63}{txt}min{col 67}={col 69}{res}         1
{txt}     Between = {res}0.0143{col 63}{txt}avg{col 67}={col 69}{res}      25.1
{txt}     Overall = {res}0.0011{col 63}{txt}max{col 67}={col 69}{res}        26

{txt}{col 49}F({res}8{txt}, {res}739{txt}){col 67}={col 70}{res}    20.21
{txt}corr(u_i, Xb) = {res}-0.5899{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}v2x_polyar~y{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}demposts_K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2} .3558963{col 26}{space 2} .1193647{col 37}{space 1}    2.98{col 46}{space 3}0.003{col 54}{space 4} .1215621{col 67}{space 3} .5902306
{txt}{space 12} {c |}
nondempost~K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2} .0562852{col 26}{space 2} .0369331{col 37}{space 1}    1.52{col 46}{space 3}0.128{col 54}{space 4}-.0162211{col 67}{space 3} .1287914
{txt}{space 12} {c |}
{space 1}iwdi_pop_3l {c |}{col 14}{res}{space 2} 3.21e-09{col 26}{space 2} 5.33e-10{col 37}{space 1}    6.02{col 46}{space 3}0.000{col 54}{space 4} 2.16e-09{col 67}{space 3} 4.25e-09
{txt}{space 1}iwdi_oda_3l {c |}{col 14}{res}{space 2}-6.13e-12{col 26}{space 2} 5.55e-12{col 37}{space 1}   -1.10{col 46}{space 3}0.270{col 54}{space 4}-1.70e-11{col 67}{space 3} 4.77e-12
{txt}iwdi_gdpp~3l {c |}{col 14}{res}{space 2} .0000219{col 26}{space 2} 3.90e-06{col 37}{space 1}    5.62{col 46}{space 3}0.000{col 54}{space 4} .0000142{col 67}{space 3} .0000295
{txt}iunhcr_re~3l {c |}{col 14}{res}{space 2}-4.09e-08{col 26}{space 2} 1.05e-08{col 37}{space 1}   -3.89{col 46}{space 3}0.000{col 54}{space 4}-6.15e-08{col 67}{space 3}-2.03e-08
{txt}iwdi_lite~3l {c |}{col 14}{res}{space 2} .0003596{col 26}{space 2} .0012362{col 37}{space 1}    0.29{col 46}{space 3}0.771{col 54}{space 4}-.0020674{col 67}{space 3} .0027865
{txt}iwdi_fuel_3l {c |}{col 14}{res}{space 2} .0003221{col 26}{space 2} .0003739{col 37}{space 1}    0.86{col 46}{space 3}0.389{col 54}{space 4} -.000412{col 67}{space 3} .0010562
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2542089{col 26}{space 2} .0646471{col 37}{space 1}    3.93{col 46}{space 3}0.000{col 54}{space 4}  .127295{col 67}{space 3} .3811228
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
     sigma_u {c |} {res} .18505233
     {txt}sigma_e {c |} {res} .08045237
         {txt}rho {c |} {res} .84103465{txt}   (fraction of variance due to u_i)
{hline 13}{c BT}{hline 64}
F test that all u_i=0: F({res}30{txt}, {res}739{txt}) = {res}74.41{col 62}{txt}Prob > F = {res}0.0000
{txt}({res}est2{txt} stored)

{com}. eststo: xtreg v2x_polyarchy  l2.demint_K l2.demnat_K $ictrls_3l_varying, fe
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res}       778
{txt}Group variable: {res}gwnoloc{txt}{col 49}Number of groups{col 67}={col 69}{res}        31

{txt}R-squared:{col 49}Obs per group:
     Within  = {res}0.1815{col 63}{txt}min{col 67}={col 69}{res}         1
{txt}     Between = {res}0.0145{col 63}{txt}avg{col 67}={col 69}{res}      25.1
{txt}     Overall = {res}0.0010{col 63}{txt}max{col 67}={col 69}{res}        26

{txt}{col 49}F({res}8{txt}, {res}739{txt}){col 67}={col 70}{res}    20.48
{txt}corr(u_i, Xb) = {res}-0.5913{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}v2x_polyar~y{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 4}demint_K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2} .7917068{col 26}{space 2} .1636693{col 37}{space 1}    4.84{col 46}{space 3}0.000{col 54}{space 4} .4703946{col 67}{space 3} 1.113019
{txt}{space 12} {c |}
{space 4}demnat_K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2}-.3770118{col 26}{space 2} .4161389{col 37}{space 1}   -0.91{col 46}{space 3}0.365{col 54}{space 4}-1.193967{col 67}{space 3} .4399435
{txt}{space 12} {c |}
{space 1}iwdi_pop_3l {c |}{col 14}{res}{space 2} 3.12e-09{col 26}{space 2} 5.32e-10{col 37}{space 1}    5.86{col 46}{space 3}0.000{col 54}{space 4} 2.07e-09{col 67}{space 3} 4.16e-09
{txt}{space 1}iwdi_oda_3l {c |}{col 14}{res}{space 2}-4.72e-12{col 26}{space 2} 5.54e-12{col 37}{space 1}   -0.85{col 46}{space 3}0.395{col 54}{space 4}-1.56e-11{col 67}{space 3} 6.16e-12
{txt}iwdi_gdpp~3l {c |}{col 14}{res}{space 2} .0000221{col 26}{space 2} 3.89e-06{col 37}{space 1}    5.68{col 46}{space 3}0.000{col 54}{space 4} .0000144{col 67}{space 3} .0000297
{txt}iunhcr_re~3l {c |}{col 14}{res}{space 2}-3.83e-08{col 26}{space 2} 1.05e-08{col 37}{space 1}   -3.65{col 46}{space 3}0.000{col 54}{space 4}-5.88e-08{col 67}{space 3}-1.77e-08
{txt}iwdi_lite~3l {c |}{col 14}{res}{space 2} .0002694{col 26}{space 2} .0012353{col 37}{space 1}    0.22{col 46}{space 3}0.827{col 54}{space 4}-.0021558{col 67}{space 3} .0026946
{txt}iwdi_fuel_3l {c |}{col 14}{res}{space 2}  .000448{col 26}{space 2} .0003704{col 37}{space 1}    1.21{col 46}{space 3}0.227{col 54}{space 4}-.0002791{col 67}{space 3} .0011751
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2569014{col 26}{space 2} .0645894{col 37}{space 1}    3.98{col 46}{space 3}0.000{col 54}{space 4} .1301009{col 67}{space 3} .3837019
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
     sigma_u {c |} {res} .18547551
     {txt}sigma_e {c |} {res} .08035624
         {txt}rho {c |} {res} .84196292{txt}   (fraction of variance due to u_i)
{hline 13}{c BT}{hline 64}
F test that all u_i=0: F({res}30{txt}, {res}739{txt}) = {res}74.51{col 62}{txt}Prob > F = {res}0.0000
{txt}({res}est3{txt} stored)

{com}. coefplot est1 est2,  keep(*dem_dummy *demposts_K *nondemposts_K) xline(0) legend(off) ylabel(1 "UNCiPPO Dem Unit" 2 "UNCiPPO Dem Posts" 3 "UNCiPPO Non-Dem Posts")
{res}{txt}
{com}. coefplot est3, keep(*demint_K *demnat_K) xline(0) legend(off) ylabel(1 "UNCiPPo Dem Int." 2 "UNCiPPO Dem Nat.")
{res}{txt}
{com}. 
. 
. *FIGURE 11
. eststo clear
{txt}
{com}. eststo: xtreg v2x_polyarchy  l2.demp_K l2.demnotp_K $ictrls_3l_varying, fe
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res}       778
{txt}Group variable: {res}gwnoloc{txt}{col 49}Number of groups{col 67}={col 69}{res}        31

{txt}R-squared:{col 49}Obs per group:
     Within  = {res}0.1780{col 63}{txt}min{col 67}={col 69}{res}         1
{txt}     Between = {res}0.0165{col 63}{txt}avg{col 67}={col 69}{res}      25.1
{txt}     Overall = {res}0.0018{col 63}{txt}max{col 67}={col 69}{res}        26

{txt}{col 49}F({res}8{txt}, {res}739{txt}){col 67}={col 70}{res}    20.01
{txt}corr(u_i, Xb) = {res}-0.6002{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}v2x_polyar~y{col 14}{c |} Coefficient{col 26}  Std. err.{col 38}      t{col 46}   P>|t|{col 54}     [95% con{col 67}f. interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}demp_K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2} .9637499{col 26}{space 2} .4780641{col 37}{space 1}    2.02{col 46}{space 3}0.044{col 54}{space 4} .0252243{col 67}{space 3} 1.902276
{txt}{space 12} {c |}
{space 3}demnotp_K {c |}
{space 9}L2. {c |}{col 14}{res}{space 2} .2856115{col 26}{space 2} .2181069{col 37}{space 1}    1.31{col 46}{space 3}0.191{col 54}{space 4}-.1425715{col 67}{space 3} .7137944
{txt}{space 12} {c |}
{space 1}iwdi_pop_3l {c |}{col 14}{res}{space 2} 3.16e-09{col 26}{space 2} 5.33e-10{col 37}{space 1}    5.93{col 46}{space 3}0.000{col 54}{space 4} 2.11e-09{col 67}{space 3} 4.20e-09
{txt}{space 1}iwdi_oda_3l {c |}{col 14}{res}{space 2}-6.12e-12{col 26}{space 2} 5.58e-12{col 37}{space 1}   -1.10{col 46}{space 3}0.273{col 54}{space 4}-1.71e-11{col 67}{space 3} 4.83e-12
{txt}iwdi_gdpp~3l {c |}{col 14}{res}{space 2} .0000221{col 26}{space 2} 3.90e-06{col 37}{space 1}    5.67{col 46}{space 3}0.000{col 54}{space 4} .0000144{col 67}{space 3} .0000298
{txt}iunhcr_re~3l {c |}{col 14}{res}{space 2}-4.03e-08{col 26}{space 2} 1.05e-08{col 37}{space 1}   -3.84{col 46}{space 3}0.000{col 54}{space 4}-6.09e-08{col 67}{space 3}-1.97e-08
{txt}iwdi_lite~3l {c |}{col 14}{res}{space 2} .0003198{col 26}{space 2} .0012377{col 37}{space 1}    0.26{col 46}{space 3}0.796{col 54}{space 4}  -.00211{col 67}{space 3} .0027497
{txt}iwdi_fuel_3l {c |}{col 14}{res}{space 2} .0004319{col 26}{space 2} .0003717{col 37}{space 1}    1.16{col 46}{space 3}0.246{col 54}{space 4}-.0002978{col 67}{space 3} .0011617
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2547684{col 26}{space 2} .0647156{col 37}{space 1}    3.94{col 46}{space 3}0.000{col 54}{space 4} .1277202{col 67}{space 3} .3818167
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
     sigma_u {c |} {res} .18667957
     {txt}sigma_e {c |} {res} .08052349
         {txt}rho {c |} {res} .84312809{txt}   (fraction of variance due to u_i)
{hline 13}{c BT}{hline 64}
F test that all u_i=0: F({res}30{txt}, {res}739{txt}) = {res}74.63{col 62}{txt}Prob > F = {res}0.0000
{txt}({res}est1{txt} stored)

{com}. coefplot est1, keep( *demp_K *demnotp_K) xline(0) xline(0) legend(off) ylabel(1  "UNCiPPO Dem P+" 2 "UNCiPPO Dem non-P+")
{res}{txt}
{com}. 
{txt}end of do-file

{com}. restore
{txt}
{com}. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}/Users/Jessica/Dropbox/1_Projects/Civilian PKO projects/Civilian Staff UN PKOs/Data Paper/Versions/1_ISQ Accepted/Replication/uncippo_replicationlog.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}20 Jan 2025, 14:24:02
{txt}{.-}
{smcl}
{txt}{sf}{ul off}